How do i integrate Hoptoad with DelayedJob and DaemonSpawn?

后端 未结 4 1796
渐次进展
渐次进展 2021-02-06 13:13

I have been happily using the DelayedJob idiom:

foo.send_later(:bar)

This calls the method bar on the object foo in the DelayedJob process.

4条回答
  •  伪装坚强ぢ
    2021-02-06 13:21

    Hoptoad uses the Rails rescue_action_in_public hook method to intercept exceptions and log them. This method is only executed when the request is dispatched by a Rails controller. For this reason, Hoptoad is completely unaware of any exception generated, for example, by rake tasks or the rails script/runner.

    If you want to have Hoptoad tracking your exception, you should manually integrate it. It should be quite straightforward. The following code fragment demonstrates how Hoptoad is invoked

    def rescue_action_in_public_with_hoptoad exception
      notify_hoptoad(exception) unless ignore?(exception) || ignore_user_agent?
      rescue_action_in_public_without_hoptoad(exception)
    end
    

    Just include Hoptoad library in your environment and call notify_hoptoad(exception) should work. Make sure your environment provides the same API of a Rails controller or Hoptoad might complain.

提交回复
热议问题