🐛 fix crash loop if template rendering fails

This commit is contained in:
Joe Kaufeld 2024-09-16 18:05:10 -04:00
parent c4a4f9ead3
commit 3cc86f0dbe

View File

@ -187,7 +187,14 @@ class SpiderwebRouter(LocalServerMixin, MiddlewareMixin, RoutesMixin, FernetMixi
start_response(status, headers) start_response(status, headers)
try:
rendered_output = resp.render() rendered_output = resp.render()
except Exception as e:
self.log.error("Fatal error!")
self.log.error(e)
self.log.error(traceback.format_exc())
return [f"Internal Server Error: {e}".encode(DEFAULT_ENCODING)]
if not isinstance(rendered_output, list): if not isinstance(rendered_output, list):
rendered_output = [rendered_output] rendered_output = [rendered_output]
encoded_resp = [ encoded_resp = [