pahanix & IT

yet another passionate programmer

1 note &

Hoptoad and rescue_from

I’m using rescue_from in my controller, but now I don’t see the exceptions in Hoptoad. Whazzup with that?

Hoptoad uses alias_method_chain to hook into the rescue_action_in_public method.

# Overrides the rescue_action method in ActionController::Base, 
# but does not inhibit any custom processing that is defined 
# with Rails 2's exception helpers.
def rescue_action_in_public_with_hoptoad exception
  notify_hoptoad(exception) unless ignore?(exception)
  rescue_action_in_public_without_hoptoad(exception)
end

The rescue_from system in Rails actually catches the exceptions before rescue_action_in_public happens. The upshot is that if you want to see those exceptions in Hoptoad, you’ll need to explicitly send them along in your rescue_from method using notify_hoptoad(exception):

rescue_from SillyError, :with => :render_silly_error

def render_silly_error(e)
  notify_hoptoad(e)
  render :template => 'i_blowzed_up'
end

Filed under rails hoptoad rescue_from

  1. pahanix posted this