This project is archived and is in readonly mode.
Ensure notifications are sent even in the case of an error
Reported by Justin George | April 30th, 2010 @ 12:10 AM | in 3.0.2
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).
Comments and changes to this ticket
-
Justin George April 30th, 2010 @ 12:12 AM
- Tag changed from 3.0, feature, notifications to 3.0, feature, notifications, patch
-
Jeremy Kemper April 30th, 2010 @ 12:27 AM
- 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).
-
Justin George April 30th, 2010 @ 12:40 AM
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?
-
José Valim April 30th, 2010 @ 09:06 AM
We need to tell someway to the subscriber that the event failed. Maybe adding an exception key with the exception class name and message.
-
Repository May 2nd, 2010 @ 09:51 PM
- 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 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 propagationSigned-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/109d3ee38d1c39f0e27bc827065427... -
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to Low
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 4505 Ensure notifications are sent even in the case of an error (from [109d3ee38d1c39f0e27bc827065427635d6396b2]) Make no...