Skip to content

Commit 8b59380

Browse files
authored
Make the 400 error handler better (#365)
This error handler does nothing but hide the real problem. Make it more like the others. Still, I'm not sure why any of these exist. All they really seem to do is obfuscate the real problem. OK, I guess they add app logging, but even the ones that pass through 'error' are probably hiding a lot of other useful information? Signed-off-by: Adam Williamson <awilliam@redhat.com>
1 parent eda5854 commit 8b59380

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

resultsdb/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ def register_handlers(app):
198198
# TODO: find out why error handler works for 404 but not for 400
199199
@app.errorhandler(400)
200200
def bad_request(error):
201-
return jsonify({"message": "Bad request"}), 400
201+
app.logger.error("Bad request: %s", error)
202+
return jsonify({"message": str(error)}), 400
202203

203204
@app.errorhandler(401)
204205
def unauthorized(error):

0 commit comments

Comments
 (0)