Skip to content

Commit

Permalink
General exception handler
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomSerg committed Jun 3, 2024
1 parent e1db395 commit 0238bc3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion xcsp3/executable/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ def memory_error_handler(args: Args):
print(flush=True)
sys.exit(0)

def error_handler(e: Exception):
print_status(ExitStatus.unknown)
print_comment(f"An error got raised: {e}")
print(flush=True)
sys.exit(0)


class Capturing(list):
def __enter__(self):
self._stdout = sys.stdout
Expand Down Expand Up @@ -606,4 +613,7 @@ def run_helper(args:Args):
signal.signal(signal.SIGABRT, sigterm_handler)

# Main program
main()
try:
main()
except Exception as e:
error_handler(e)

0 comments on commit 0238bc3

Please sign in to comment.