This commit is contained in:
L. Karkkainen 2023-02-07 11:00:05 +00:00
parent da9ff33fa7
commit a6efebda56
2 changed files with 7 additions and 11 deletions

View File

@ -875,6 +875,8 @@ class Sanic(StaticHandleMixin, BaseSanic, StartupMixin, metaclass=TouchUpMeta):
:param request: HTTP Request object
:return: Nothing
"""
__tracebackhide__ = True
await self.dispatch(
"http.lifecycle.handle",
inline=True,

View File

@ -73,12 +73,7 @@ class ErrorPage(BasePage):
)
if self.exc:
self.doc.h2(f"Exception in {route_name}:")
# skip_outmost=1 to hide Sanic.handle_request
self.doc(
html_traceback(
self.exc, skip_outmost=1, include_js_css=False
)
)
self.doc(html_traceback(self.exc, include_js_css=False))
self._key_value_table(
f"{self.request.method} {self.request.path}",
@ -92,10 +87,9 @@ class ErrorPage(BasePage):
with self.doc.table(id=table_id, class_="key-value-table smalltext"):
self.doc.caption(title)
for key, value in data.items():
# Reading values may cause a new exception, so suppress it
try:
self.doc.tr.td(key, class_="nobr key").td(value)
# Printing values may cause a new exception, so suppress it
value = str(value)
except Exception:
self.doc.tr.td(key, class_="nobr key").td.em(
"Unable to display value"
)
value = E.em("Unable to display value")
self.doc.tr.td.span(key, class_="nobr key").td(value)