diff --git a/adafruit_wsgi/wsgi_app.py b/adafruit_wsgi/wsgi_app.py index 249fbdf..a9e78ae 100644 --- a/adafruit_wsgi/wsgi_app.py +++ b/adafruit_wsgi/wsgi_app.py @@ -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