bjg
2013-Jan-02 18:34 UTC
Why does ActiveSupport::Notifications::Instrumenter make payload[:exception] an array?
Hi, This is probably a stupid question, but I''m wondering if anyone knows why https://github.com/rails/rails/blob/master/activesupport/lib/active_support/notifications/instrumenter.rb doesn''t just save the actual exception in the payload when an exception occurs. Instead it does this: *rescue Exception => e* * payload[:exception] = [e.class.name, e.message]* * raise e* * * * * Thanks -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/gQJf7Bm672UJ. For more options, visit https://groups.google.com/groups/opt_out.
tamouse mailing lists
2013-Jan-04 03:41 UTC
Re: Why does ActiveSupport::Notifications::Instrumenter make payload[:exception] an array?
On Wed, Jan 2, 2013 at 12:34 PM, bjg <brendan.grainger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> This is probably a stupid question, but I''m wondering if anyone knows why > > https://github.com/rails/rails/blob/master/activesupport/lib/active_support/notifications/instrumenter.rb > > doesn''t just save the actual exception in the payload when an exception > occurs. Instead it does this: > > rescue Exception => e > payload[:exception] = [e.class.name, e.message] > raise eThose are the only things it needs to make a notification, what type of exception it was, and the associated error message. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
bjg
2013-Jan-04 13:34 UTC
Re: Why does ActiveSupport::Notifications::Instrumenter make payload[:exception] an array?
But I can subscribe to a notification and get access to the ''exception'' in the payload like so: ActiveSupport::Notifications.subscribe "process_action.action_controller" do |name, start, finish, id, payload| exception = payload[:exception] # If the entire exception were in the payload or at least something containing # the stacktrace I could log it, send an email etc. end I realize it''s probably the way it is because we want the payload to be easily serializable so that if we want to push the event to redis or something that can be easily done, but might be nice if the stacktrace were available too. On Thursday, January 3, 2013 10:41:55 PM UTC-5, tamouse wrote: On Wed, Jan 2, 2013 at 12:34 PM, bjg <brendan....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:>>> wrote: > > This is probably a stupid question, but I''m wondering if anyone knows > why > > > > > https://github.com/rails/rails/blob/master/activesupport/lib/active_support/notifications/instrumenter.rb > > > > doesn''t just save the actual exception in the payload when an exception > > occurs. Instead it does this: > > > > rescue Exception => e > > payload[:exception] = [e.class.name, e.message] > > raise e > > Those are the only things it needs to make a notification, what type > of exception it was, and the associated error message. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/ZSY-q7O12xcJ. For more options, visit https://groups.google.com/groups/opt_out.