如何解决如何在Servant处理程序中未捕获的异常上打印堆栈跟踪?
当我使用剖析信息构建应用程序时,未捕获的异常会导致将漂亮的堆栈跟踪信息打印到控制台。例如:
CallStack (from -prof):
Redacted.Booking.API.Callback.Parse.parseFromEnv (src/Redacted/Booking/API/Callback/Parse.hs:(38,1)-(40,93))
Main.main.readCallbackUrl (app/Main.hs:(51,5)-(54,77))
Control.Exception.Lifted.finally.\ (Control/Exception/Lifted.hs:(426,22)-(427,47))
Control.Monad.Trans.Control.liftBaseWith (Control/Monad/Trans/Control.hs:627:66-86)
Control.Monad.Trans.Control.control (Control/Monad/Trans/Control.hs:751:1-39)
Control.Exception.Lifted.finally (Control/Exception/Lifted.hs:(425,1)-(427,47))
Control.Logging.withStderrLogging (Control/Logging.hs:(165,1)-(169,24))
Redacted.Logging.withStderrLogging (src/Redacted/Logging.hs:(26,1)-(31,40))
Main.main (app/Main.hs:(37,1)-(54,77))
但是,如果在Servant处理程序中发生未捕获的异常,则不会打印堆栈跟踪-仅显示异常,例如:
Prelude.maximum: empty list
我正在使用Stack进行构建,同时在我的stack.yaml中添加以下内容:
build:
library-profiling: true
executable-profiling: true
如何为Servant处理程序中发生的未捕获异常打印堆栈跟踪?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。