API: set the status code on errors

master
justcool393 2022-10-12 01:17:48 -07:00
parent db0fd8a0e9
commit eaf361ad91
1 changed files with 1 additions and 1 deletions

View File

@ -30,7 +30,7 @@ def error(e):
if WERKZEUG_ERROR_DESCRIPTIONS.get(e.code, None) == details: if WERKZEUG_ERROR_DESCRIPTIONS.get(e.code, None) == details:
details = None details = None
if request.headers.get("Authorization") or request.headers.get("xhr"): if request.headers.get("Authorization") or request.headers.get("xhr"):
return {"error": title, "code": e.code, "description": msg, "details": details} return {"error": title, "code": e.code, "description": msg, "details": details}, e.code
img = ERROR_MARSEYS.get(e.code, 'marseyl') img = ERROR_MARSEYS.get(e.code, 'marseyl')
return render_template('errors/error.html', err=True, title=title, msg=msg, details=details, img=img), e.code return render_template('errors/error.html', err=True, title=title, msg=msg, details=details, img=img), e.code