#10 new
Jacob

[PATCH] exception_notifiable should hook into rescue_from

Reported by Jacob | May 12th, 2008 @ 03:56 PM

The exception_notifiable plugin should be updated to use the latest rails convention for rescuing exceptions. That convention being to define the handling of exceptions with rescue_from handlers. As opposed to the exception_notification convention of defining render_404 and render_500.

I propose the plugin should define 'exception_notify' as a corollary to the 'rescue_from' method.

And should override (alias_method_chain on) rescue_action_with_handler to notify of an exception that we care about.

Example:

old style was:


  include ExceptionNotifiable
  
  def render_500
    render :text => "500", :status => 500
  end

  def render_404
    render :text => "404", :status => 404
  end

proposed new style:


  include ExceptionNotifiable
    
  rescue_from ActiveRecord::RecordNotFound do |exception|
    render :text => "404", :status => 404
  end

  rescue_from RuntimeError do |exception|
    render :text => "500", :status => 500
  end
  
  exception_notify RuntimeError

(old style will still be supported)

Comments and changes to this ticket

  • Jacob

    Jacob May 12th, 2008 @ 04:01 PM

    • → Title changed from “exception_notifiable should use rescue_from” to “exception_notifiable should hook into rescue_from”

    I assume that since I can't find the rails plugins on github, they are still being maintained in svn.

    Which means I should submit a patch against the latest from:

    http://svn.rubyonrails.org/rails...

    is that correct?

  • Jacob

    Jacob May 12th, 2008 @ 06:43 PM

    • → Title changed from “exception_notifiable should hook into rescue_from” to “[PATCH] exception_notifiable should hook into rescue_from”

    attaching path for proposed solution

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket