Skip to content
Snippets Groups Projects
Unverified Commit 62f78013 authored by Xavier Robin's avatar Xavier Robin
Browse files

refactor: make error messages more consistent in actions

parent 9169bbc8
No related branches found
No related tags found
No related merge requests found
...@@ -302,7 +302,6 @@ def _CheckCompoundLib(): ...@@ -302,7 +302,6 @@ def _CheckCompoundLib():
ost.LogError("A compound library is required for this action. " ost.LogError("A compound library is required for this action. "
"Please refer to the OpenStructure website: " "Please refer to the OpenStructure website: "
"https://openstructure.org/docs/conop/compoundlib/.") "https://openstructure.org/docs/conop/compoundlib/.")
sys.tracebacklimit = 0
raise RuntimeError("No compound library found") raise RuntimeError("No compound library found")
...@@ -333,8 +332,6 @@ def _LoadStructure(structure_path, sformat, fault_tolerant, bu_id): ...@@ -333,8 +332,6 @@ def _LoadStructure(structure_path, sformat, fault_tolerant, bu_id):
The returned structure has structure_path attached as structure name 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 # increase loglevel, as we would pollute the info log with weird stuff
ost.PushVerbosityLevel(ost.LogLevel.Error) ost.PushVerbosityLevel(ost.LogLevel.Error)
...@@ -591,8 +588,10 @@ def _Process(model, model_ligands, reference, reference_ligands, args): ...@@ -591,8 +588,10 @@ def _Process(model, model_ligands, reference, reference_ligands, args):
def _Main(): def _Main():
args = _ParseArgs() args = _ParseArgs()
_CheckCompoundLib()
ost.PushVerbosityLevel(args.verbosity) ost.PushVerbosityLevel(args.verbosity)
if args.verbosity < 4:
sys.tracebacklimit = 0
_CheckCompoundLib()
try: try:
# Load structures # Load structures
reference_format = _GetStructureFormat(args.reference, reference_format = _GetStructureFormat(args.reference,
......
...@@ -578,8 +578,6 @@ def _LoadStructure(structure_path, sformat, fault_tolerant, bu_id): ...@@ -578,8 +578,6 @@ def _LoadStructure(structure_path, sformat, fault_tolerant, bu_id):
The returned structure has structure_path attached as structure name 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 # increase loglevel, as we would pollute the info log with weird stuff
ost.PushVerbosityLevel(ost.LogLevel.Error) ost.PushVerbosityLevel(ost.LogLevel.Error)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment