From 0c8a86093d2dd0d953d5394cb52d4c66831678a5 Mon Sep 17 00:00:00 2001
From: Gabriel Studer <gabriel.studer@unibas.ch>
Date: Wed, 1 Mar 2023 11:50:31 +0100
Subject: [PATCH] compare-structures: Make errors more verbose

Before the program wrote the traceback into the output json but
exited silently. Now we re-raise upon writing the output.
---
 actions/ost-compare-structures-new | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/actions/ost-compare-structures-new b/actions/ost-compare-structures-new
index a4d06461a..89d5eee20 100644
--- a/actions/ost-compare-structures-new
+++ b/actions/ost-compare-structures-new
@@ -388,6 +388,7 @@ def _Process(model, reference, args):
         io.SavePDB(scorer.model, model.GetName() + args.dump_suffix)
         io.SavePDB(scorer.target, reference.GetName() + args.dump_suffix)
 
+
     return out
 
 def _Main():
@@ -399,13 +400,15 @@ def _Main():
         model = _LoadStructure(args.model, sformat=args.model_format)
         out = _Process(model, reference, args)
         out["status"] = "SUCCESS"
+        with open(args.output, 'w') as fh:
+            json.dump(out, fh, indent=4, sort_keys=False)
     except:
         out = dict()
         out["status"] = "FAILURE"
         out["traceback"] = traceback.format_exc()
-
-    with open(args.output, 'w') as fh:
-        json.dump(out, fh, indent=4, sort_keys=False)
+        with open(args.output, 'w') as fh:
+            json.dump(out, fh, indent=4, sort_keys=False)
+        raise
 
 if __name__ == '__main__':
     _Main()
-- 
GitLab