Don't send stackdumps by mail in DEVELOPMENT environment

This commit is contained in:
Keith Edmunds 2022-12-24 18:46:04 +00:00
parent 94b2f473e9
commit ea4d7693ef

View File

@ -75,9 +75,10 @@ def log_uncaught_exceptions(_ex_cls, ex, tb):
logging.critical(''.join(traceback.format_tb(tb)))
print("\033[1;37;40m")
print(stackprinter.format(ex, style="darkbg2", add_summary=True))
msg = stackprinter.format(ex)
send_mail(Config.ERRORS_TO, Config.ERRORS_FROM,
"Exception from musicmuster", msg)
if os.environ("MM_ENV") != "DEVELOPMENT":
msg = stackprinter.format(ex)
send_mail(Config.ERRORS_TO, Config.ERRORS_FROM,
"Exception from musicmuster", msg)
sys.excepthook = log_uncaught_exceptions