自定义内部错误回调 #504
FHU-yezi
started this conversation in
Feature request
自定义内部错误回调
#504
Replies: 1 comment 3 replies
-
pywebio在执行用户逻辑时产生的异常会输出到 更灵活的方式是在应用函数上加入 |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
希望可以在应用发生内部错误时触发一个自定义回调函数,以便将错误信息记录到日志中。
函数的签名如下:
on_internal_error(callback: Callable) -> None
接收一个回调函数,向其传入以下参数:
app_name: str
:发生错误的应用名称is_in_debug: bool
:是否处于 Debug 模式info
:pywebio.session.info
对象,用于记录用户的浏览器信息traceback
:错误栈函数返回一个元组,各位置参数解释如下:
Union[bool, str]
:为 True 时显示内部错误提示,为 False 则不显示,为字符串时,显示自定义的错误提示bool
:如果为 True,完成错误处理后关闭连接,释放服务器资源bool
:如果为 True,完成错误处理后重载页面,不能与第二个bool
参数同时为 TrueBeta Was this translation helpful? Give feedback.
All reactions