This project is archived and is in readonly mode.
Ensure notifications are sent even in the case of an error
-
Justin George
- Tag changed from 3.0, feature, notifications to 3.0, feature, notifications, patch
-
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).
-
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" endend
should generate a few events:
%w(sql.active_record sql.active_record error.action_controller perform_action.active_controller) # possibly more that I'm forgettingthat'll let plugins like exception notification basically instrument via this kind of thing:
ActiveSupport::Notifications.subscribe('error.action_controller') do |event| ExceptionNotifier.notify( ... ) endThis is all only my unclear understanding - comments?
-
Jeremy Kemper
Gotcha. +1
-
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.
-
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 propagationSigned-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/109d3ee38d1c39f0e27bc827065427...
