fdsfsd
This commit is contained in:
parent
08b4773941
commit
9a8eed5e04
7 changed files with 18 additions and 13 deletions
|
@ -15,7 +15,7 @@ from files.__main__ import app, limiter
|
|||
@auth_desired
|
||||
def error_400(e, v):
|
||||
if request.headers.get("Authorization"): return {"error": "400 Bad Request"}, 400
|
||||
else: return render_template('errors/400.html', v=v), 400
|
||||
else: return render_template('errors/400.html', error=True, v=v), 400
|
||||
|
||||
@app.errorhandler(401)
|
||||
def error_401(e):
|
||||
|
@ -33,28 +33,28 @@ def error_401(e):
|
|||
@auth_desired
|
||||
def error_403(e, v):
|
||||
if request.headers.get("Authorization"): return {"error": "403 Forbidden"}, 403
|
||||
else: return render_template('errors/403.html', v=v), 403
|
||||
else: return render_template('errors/403.html', error=True, v=v), 403
|
||||
|
||||
|
||||
@app.errorhandler(404)
|
||||
@auth_desired
|
||||
def error_404(e, v):
|
||||
if request.headers.get("Authorization"): return {"error": "404 Not Found"}, 404
|
||||
else: return render_template('errors/404.html', v=v), 404
|
||||
else: return render_template('errors/404.html', error=True, v=v), 404
|
||||
|
||||
|
||||
@app.errorhandler(405)
|
||||
@auth_desired
|
||||
def error_405(e, v):
|
||||
if request.headers.get("Authorization"): return {"error": "405 Method Not Allowed"}, 405
|
||||
else: return render_template('errors/405.html', v=v), 405
|
||||
else: return render_template('errors/405.html', error=True, v=v), 405
|
||||
|
||||
|
||||
@app.errorhandler(429)
|
||||
@auth_desired
|
||||
def error_429(e, v):
|
||||
if request.headers.get("Authorization"): return {"error": "429 Too Many Requests"}, 429
|
||||
else: return render_template('errors/429.html', v=v), 429
|
||||
else: return render_template('errors/429.html', error=True, v=v), 429
|
||||
|
||||
|
||||
@app.errorhandler(500)
|
||||
|
@ -63,7 +63,7 @@ def error_500(e, v):
|
|||
g.db.rollback()
|
||||
|
||||
if request.headers.get("Authorization"): return {"error": "500 Internal Server Error"}, 500
|
||||
else: return render_template('errors/500.html', v=v), 500
|
||||
else: return render_template('errors/500.html', error=True, v=v), 500
|
||||
|
||||
|
||||
@app.post("/allow_nsfw")
|
||||
|
@ -78,7 +78,7 @@ def allow_nsfw():
|
|||
def error_all_preview(error, v):
|
||||
|
||||
try:
|
||||
return render_template(f"errors/{error}.html", v=v)
|
||||
return render_template(f"errors/{error}.html", error=True, v=v)
|
||||
except jinja2.exceptions.TemplateNotFound:
|
||||
abort(400)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue