error printer can be used for exception and not-exception errors
parent
73c37988f4
commit
d34b1f5b35
5
main.py
5
main.py
|
@ -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
|
||||||
|
|
Reference in New Issue