🐛 fix crash loop if template rendering fails
This commit is contained in:
parent
c4a4f9ead3
commit
3cc86f0dbe
@ -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 = [
|
||||||
|
Loading…
Reference in New Issue
Block a user