Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Ensure notifications are sent even in the case of an error

#4505

Notifications currently will not be sent in the case of an error in the notified block.

This may or may not be desired, but I have use cases (transaction tracing) that would be better served by notification regardless of errors.

For example:

ActiveRecord::Base.transaction do
  raise "Error!"
end

Should state that there was a transaction, and that it took (some small amount of time).

Reported by Justin George · April 30th, 2010 @ 12:10 AM

State: resolved
Milestone: 3.0.2
Assigned to: José Valim José Valim
Importance: Low

Activity

  1. Justin George
    Justin George
    • Tag changed from 3.0, feature, notifications to 3.0, feature, notifications, patch

    April 30th, 2010 @ 12:12 AM

  2. Jeremy Kemper
    Jeremy Kemper
    • Milestone cleared.
    • State changed from new to open
    • Assigned user set to José Valim

    Perhaps this should include the exception if one occurred (rescue rather than ensure).

    April 30th, 2010 @ 12:27 AM

  3. Justin George
    Justin George

    Exceptions are intended to create their own notifications, at least if they occur in the request cycle.

    i.e. hitting an action:

    def my_action

     transaction do
       raise "Some Error"
     end
    

    end

    should generate a few events:

    %w(sql.active_record sql.active_record error.action_controller perform_action.active_controller) # possibly more that I'm forgetting
    

    that'll let plugins like exception notification basically instrument via this kind of thing:

    ActiveSupport::Notifications.subscribe('error.action_controller') do |event|
      ExceptionNotifier.notify( ... ) 
    end
    

    This is all only my unclear understanding - comments?

    April 30th, 2010 @ 12:40 AM

  4. Jeremy Kemper
  5. José Valim
    José Valim

    We need to tell someway to the subscriber that the event failed. Maybe adding an exception key with the exception class name and message.

    April 30th, 2010 @ 09:06 AM

  6. Repository
    Repository
    • State changed from open to resolved

    (from [109d3ee38d1c39f0e27bc827065427635d6396b2]) Make notifications go off even when an error is raised, so that we capture the underlying performance data [#4505 Ensure notifications are sent even in the case of an error state:resolved]

    This is important when trying to keep track of many layers of interrelated calls

    i.e.:

    ActiveRecord::Base.transaction do
    MyModel.find(1) #ActiveRecord::NotFound end # should capture the full time until the error propagation

    Signed-off-by: José Valim jose.valim@gmail.com
    http://github.com/rails/rails/commit/109d3ee38d1c39f0e27bc827065427...

    May 2nd, 2010 @ 09:51 PM

  7. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.0.2
    • Importance changed from to Low

    October 15th, 2010 @ 11:01 PM