From 62f780130f99be05ee8e13cb90d35f56e617a104 Mon Sep 17 00:00:00 2001 From: Xavier Robin <xavalias-github@xavier.robin.name> Date: Mon, 5 Feb 2024 10:35:13 +0100 Subject: [PATCH] refactor: make error messages more consistent in actions --- actions/ost-compare-ligand-structures | 7 +++---- actions/ost-compare-structures | 2 -- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/actions/ost-compare-ligand-structures b/actions/ost-compare-ligand-structures index dd82320f1..191b6ee5c 100644 --- a/actions/ost-compare-ligand-structures +++ b/actions/ost-compare-ligand-structures @@ -302,7 +302,6 @@ def _CheckCompoundLib(): ost.LogError("A compound library is required for this action. " "Please refer to the OpenStructure website: " "https://openstructure.org/docs/conop/compoundlib/.") - sys.tracebacklimit = 0 raise RuntimeError("No compound library found") @@ -333,8 +332,6 @@ def _LoadStructure(structure_path, sformat, fault_tolerant, bu_id): The returned structure has structure_path attached as structure name """ - if not os.path.exists(structure_path): - raise Exception(f"file not found: {structure_path}") # increase loglevel, as we would pollute the info log with weird stuff ost.PushVerbosityLevel(ost.LogLevel.Error) @@ -591,8 +588,10 @@ def _Process(model, model_ligands, reference, reference_ligands, args): def _Main(): args = _ParseArgs() - _CheckCompoundLib() ost.PushVerbosityLevel(args.verbosity) + if args.verbosity < 4: + sys.tracebacklimit = 0 + _CheckCompoundLib() try: # Load structures reference_format = _GetStructureFormat(args.reference, diff --git a/actions/ost-compare-structures b/actions/ost-compare-structures index 36baa6c04..d16ce8c86 100644 --- a/actions/ost-compare-structures +++ b/actions/ost-compare-structures @@ -578,8 +578,6 @@ def _LoadStructure(structure_path, sformat, fault_tolerant, bu_id): The returned structure has structure_path attached as structure name """ - if not os.path.exists(structure_path): - raise Exception(f"file not found: {structure_path}") # increase loglevel, as we would pollute the info log with weird stuff ost.PushVerbosityLevel(ost.LogLevel.Error) -- GitLab