Skip to content

Commit 25f207a

Browse files
committed
Properly handle subrequest exceptions
We weren't passing exceptions through the flask exception translation layer, so we'd end up with extra verbose logging when *desired* exceptions (like BadPermission) get raised, rather than handle and building those into a proper subrequest error response. Fixes #132.
1 parent c0dbb30 commit 25f207a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sogs/routes/subrequest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ def make_subrequest(
9595
app.logger.debug(f"Initiating sub-request for {method} {path}")
9696
g.user_reauth = user_reauth
9797
with app.request_context(subreq_env):
98-
response = app.full_dispatch_request()
98+
try:
99+
response = app.full_dispatch_request()
100+
except Exception as e:
101+
response = app.make_response(app.handle_exception(e))
99102
if response.status_code >= 400:
100103
app.logger.warning(
101104
f"Sub-request for {method} {path} returned status {response.status_code}"

0 commit comments

Comments
 (0)