Closed BattlefieldDuck closed 6 months ago
When a user calls the abort(400) function, the Flask monitoring dashboard mistakenly records a status code of 500 instead of the expected 400.
abort(400)
from flask import abort @app.route('/search', methods=['GET']) def search(): abort(400) # <- raise HTTPException
The underlying issue is that the HTTPException is being caught as a generic Exception, which is then incorrectly returned as a 500 error.
HTTPException
Exception
This pull request addresses and resolves this issue.
For more information on the Flask abort() function: https://flask.palletsprojects.com/en/2.3.x/errorhandling/#custom-error-pages
abort()
Hey @BattlefieldDuck Thank you for the fix!
When a user calls the
abort(400)
function, the Flask monitoring dashboard mistakenly records a status code of 500 instead of the expected 400.The underlying issue is that the
HTTPException
is being caught as a genericException
, which is then incorrectly returned as a 500 error.This pull request addresses and resolves this issue.
For more information on the Flask
abort()
function: https://flask.palletsprojects.com/en/2.3.x/errorhandling/#custom-error-pages