error printer can be used for exception and not-exception errors
parent
73c37988f4
commit
d34b1f5b35
7
main.py
7
main.py
|
@ -14,9 +14,12 @@ 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)
|
||||||
traceback.print_stack()
|
if is_exception:
|
||||||
|
traceback.print_exc()
|
||||||
|
else:
|
||||||
|
traceback.print_stack()
|
||||||
if handle_gracefully:
|
if handle_gracefully:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
|
Reference in New Issue