将 BackTrace 添加到 Hoptoad Notify 方法

发布于 2025-01-01 07:38:56 字数 333 浏览 0 评论 0原文

我的代码如下所示:

 raise "Invalid destination "
rescue Exception => e
        HoptoadNotifier.notify(:error_class => e, :error_message => "#{e} : Error occured for the user #{self.user_name}")

我实际上希望在 hoptoad 中将错误消息记录为 “无效目的地:用户用户名发生错误”。如上所示的代码按预期工作。但我无法在 hoptoad 中获取回溯。请就此提出建议。

I have the code as shown below:

 raise "Invalid destination "
rescue Exception => e
        HoptoadNotifier.notify(:error_class => e, :error_message => "#{e} : Error occured for the user #{self.user_name}")

I actually want the error message to be logged in the hoptoad as "Invalid destination : Error occured for the user username". The code as shown above works as intented. But im not able to get the back trace in the hoptoad. Please suggest on this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

余罪 2025-01-08 07:38:56

显式地将 e.backtrace 传递给 Hoptoad.nofity

raise "Invalid destination "
rescue Exception => e
  HoptoadNotifier.notify(:error_class => e, :error_message => "#{e} : Error occured for the user #{self.user_name}", :parameters => { backtrace => e.backtrace })

Explicitly pass e.backtrace to Hoptoad.nofity:

raise "Invalid destination "
rescue Exception => e
  HoptoadNotifier.notify(:error_class => e, :error_message => "#{e} : Error occured for the user #{self.user_name}", :parameters => { backtrace => e.backtrace })
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文