error printer can be used for exception and not-exception errors

master
BodgeMaster 2022-02-14 13:27:27 +01:00
parent 73c37988f4
commit d34b1f5b35
1 changed files with 5 additions and 2 deletions

View File

@ -14,8 +14,11 @@ def warn(message):
print("WARNING: "+str(message), file=sys.stderr) print("WARNING: "+str(message), file=sys.stderr)
traceback.print_stack() traceback.print_stack()
def error(message, handle_gracefully=True): def error(message, is_exception=True, handle_gracefully=True):
print("ERROR: "+str(message), file=sys.stderr) print("ERROR: "+str(message), file=sys.stderr)
if is_exception:
traceback.print_exc()
else:
traceback.print_stack() traceback.print_stack()
if handle_gracefully: if handle_gracefully:
pass pass