def error_handler(e): code = getattr(e, 'code', 500) # If 500, e == the exception. if code == 500: # Send email to all ADMINS. exception_name = e.__class__.__name__ view_module = request.endpoint send_exception('{} exception in {}'.format(exception_name, view_module)) return render_template('errors/{}.html'.format(code)), code
def celery_error_handler(sender, exception, **_): exception_name = exception.__class__.__name__ task_module = sender.name send_exception('{} exception in {}'.format(exception_name, task_module))