Updated error object to comply with the API definition
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pünkösd Marcell 2020-03-25 01:58:48 +01:00
parent ba3d4feab5
commit 7f9a89814c

View File

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