- error handling now uses a more comprehensive error communication system.
This commit is contained in:
@@ -9,31 +9,31 @@ from common.utils.eveai_exceptions import EveAINoSessionTenant
|
||||
def not_found_error(error):
|
||||
current_app.logger.error(f"Not Found Error: {error}")
|
||||
current_app.logger.error(traceback.format_exc())
|
||||
return render_template('error.html', message="Page not found."), 404
|
||||
return render_template('error/404.html'), 404
|
||||
|
||||
|
||||
def internal_server_error(error):
|
||||
current_app.logger.error(f"Internal Server Error: {error}")
|
||||
current_app.logger.error(traceback.format_exc())
|
||||
return render_template('error.html', message="Internal server error."), 500
|
||||
return render_template('error/500.html'), 500
|
||||
|
||||
|
||||
def not_authorised_error(error):
|
||||
current_app.logger.error(f"Not Authorised Error: {error}")
|
||||
current_app.logger.error(traceback.format_exc())
|
||||
return render_template('error.html', message="Not authorized."), 401
|
||||
return render_template('error/401.html'), 401
|
||||
|
||||
|
||||
def access_forbidden(error):
|
||||
current_app.logger.error(f"Access Forbidden: {error}")
|
||||
current_app.logger.error(traceback.format_exc())
|
||||
return render_template('error.html', message="Access forbidden."), 403
|
||||
return render_template('error/403.html'), 403
|
||||
|
||||
|
||||
def key_error_handler(error):
|
||||
current_app.logger.error(f"Key Error: {error}")
|
||||
current_app.logger.error(traceback.format_exc())
|
||||
return render_template('error.html', message="An unexpected error occurred."), 500
|
||||
return render_template('error/500.html'), 500
|
||||
|
||||
|
||||
def attribute_error_handler(error):
|
||||
@@ -41,7 +41,7 @@ def attribute_error_handler(error):
|
||||
error_msg = str(error)
|
||||
current_app.logger.error(f"AttributeError: {error_msg}")
|
||||
current_app.logger.error(traceback.format_exc())
|
||||
return render_template('error.html', message="An application error occurred."), 500
|
||||
return render_template('error/500.html'), 500
|
||||
|
||||
|
||||
def no_tenant_selected_error(error):
|
||||
|
||||
Reference in New Issue
Block a user