Updated error object to comply with the API definition
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Pünkösd Marcell 2020-03-25 01:58:48 +01:00
parent ba3d4feab5
commit 7f9a89814c
1 changed files with 10 additions and 11 deletions

View File

@ -1,10 +1,10 @@
#!/usr/bin/env python3
from flask import jsonify
def get_standard_error_handler(code: int):
def error_handler(err):
return {"msg": str(err)}, code
return jsonify({"msg": err.description, "status": str(code)}), code
return error_handler
@ -18,4 +18,3 @@ def register_all_error_handlers(app):
for code in error_codes_to_override:
app.register_error_handler(code, get_standard_error_handler(code))