warn() has a flag to print exception stack traces now

master
BodgeMaster 2022-02-14 14:02:40 +01:00
parent a38e38f96e
commit 4f844b6480
1 changed files with 5 additions and 2 deletions

View File

@ -10,9 +10,12 @@ import sys, os, json, traceback
EXIT_SUCCESS=0
EXIT_ERROR=1
def warn(message):
def warn(message, is_exception=False):
print("WARNING: "+str(message), file=sys.stderr)
traceback.print_stack()
if is_exception:
traceback.print_exc()
else:
traceback.print_stack()
def error(message, is_exception=True, handle_gracefully=True):
print("ERROR: "+str(message), file=sys.stderr)