Skip to content

Commit

Permalink
Merge pull request #13 from tekktrik/dev/clearer-bad-return
Browse files Browse the repository at this point in the history
Clearer error raised when function gives improper HTTP response return
  • Loading branch information
dhalbert authored Mar 16, 2022
2 parents 237b94d + b92d562 commit 980d787
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions adafruit_wsgi/wsgi_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,14 @@ def __call__(self, environ: Dict[str, str], start_response: Callable):

if match:
args, route = match
status, headers, resp_data = route["func"](request, *args)

try:
status, headers, resp_data = route["func"](request, *args)
except (ValueError, TypeError) as err:
raise RuntimeError(
"Proper HTTP response return not given for request handler '{}'".format(
route["func"].__name__
)
) from err
start_response(status, headers)
return resp_data

Expand Down

0 comments on commit 980d787

Please sign in to comment.