From d2fbeb7b2345cb8225f911e704a38ad39143665e Mon Sep 17 00:00:00 2001 From: Believethehype Date: Fri, 29 Dec 2023 23:39:42 +0100 Subject: [PATCH] error handling --- nostr_dvm/dvm.py | 2 ++ nostr_dvm/interfaces/dvmtaskinterface.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/nostr_dvm/dvm.py b/nostr_dvm/dvm.py index 6a00219..d23339f 100644 --- a/nostr_dvm/dvm.py +++ b/nostr_dvm/dvm.py @@ -493,6 +493,8 @@ class DVM: if line != '\n': result += line os.remove(os.path.abspath('output.txt')) + if result.startswith("Error:"): + raise Exception else: # Some components might have issues with running code in otuside venv. # We install locally in these cases for now result = dvm.process(request_form) diff --git a/nostr_dvm/interfaces/dvmtaskinterface.py b/nostr_dvm/interfaces/dvmtaskinterface.py index 93ed6da..de4729d 100644 --- a/nostr_dvm/interfaces/dvmtaskinterface.py +++ b/nostr_dvm/interfaces/dvmtaskinterface.py @@ -145,5 +145,6 @@ def process_venv(identifier): result = dvm.process(json.loads(args.request)) DVMTaskInterface.write_output(result, args.output) except Exception as e: - DVMTaskInterface.write_output(str(e), args.output) + DVMTaskInterface.write_output("Error: " + str(e), args.output) + raise Exception