Skip to content

Commit d0cbbb2

Browse files
supertassuGithub Action
andauthored
app: Improve 500 handler (#95)
* app: Improve 500 handler * Do not accidentally handle other errors (like 404s). * Actually set a 500 status code for these. Change-Id: Ic7202fe9899a8b625b3751bc085d19980334ff68 * auto update of tag --------- Co-authored-by: Github Action <[email protected]>
1 parent 17d9fc8 commit d0cbbb2

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

helm-quarry/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
web:
22
repository: 'quay.io/wikimedia-quarry/quarry'
3-
tag: pr-94 # web tag managed by github actions
3+
tag: pr-95 # web tag managed by github actions
44
resources:
55
requests:
66
memory: "300Mi"
@@ -11,7 +11,7 @@ web:
1111

1212
worker:
1313
repository: 'quay.io/wikimedia-quarry/quarry'
14-
tag: pr-94 # worker tag managed by github actions
14+
tag: pr-95 # worker tag managed by github actions
1515
resources:
1616
requests:
1717
memory: "400Mi"

quarry/web/app.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from flask import current_app, Flask, render_template, g, Response
22
from flask_caching import Cache
3+
from werkzeug.exceptions import HTTPException
34
from werkzeug.middleware.proxy_fix import ProxyFix
45

56
from .config import get_config
@@ -31,7 +32,10 @@ def kill_context(exception=None):
3132

3233

3334
def handle_internal_error(e: Exception):
34-
return render_template("500.html")
35+
if isinstance(e, HTTPException):
36+
return e
37+
current_app.logger.error("Failed to handle request", exc_info=e)
38+
return render_template("500.html"), 500
3539

3640

3741
def create_app(test_config=None):

0 commit comments

Comments
 (0)