diff options
author | 2021-02-25 14:15:15 +0100 | |
---|---|---|
committer | 2021-02-25 14:15:15 +0100 | |
commit | 8939c8e127d49f9f534679d5ff9bdef907730e13 (patch) | |
tree | 1824692a9611f3990dd764da11c35c3b59a4d4be /resources | |
parent | Don't communicate the traceback back to the backend (diff) |
Add return code 6 for exceptions when loading module
Diffstat (limited to 'resources')
-rw-r--r-- | resources/unittest_template.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/resources/unittest_template.py b/resources/unittest_template.py index 755f7cc..02d3894 100644 --- a/resources/unittest_template.py +++ b/resources/unittest_template.py @@ -25,6 +25,7 @@ def _exit_sandbox(code: int) -> NoReturn: Codes: - 0: Executed with success - 5: Syntax error while parsing user code + - 6: Uncaught exception while loading user code - 99: Internal error """ print(RESULT.getvalue(), file=ORIGINAL_STDOUT, end="") @@ -74,8 +75,12 @@ try: sys.stderr = DEVNULL # Load the user code as a global module variable - module = _load_user_module() + try: + module = _load_user_module() + except Exception: + RESULT.write("Uncaught exception while loading user code.") + _exit_sandbox(6) _main() except Exception: - print("Uncaught exception inside runner.", file=RESULT) - _exit_sandbox(99)
\ No newline at end of file + RESULT.write("Uncaught exception inside runner.") + _exit_sandbox(99) |