lib/honeybadger/agent.rb in honeybadger-5.0.0.beta1 vs lib/honeybadger/agent.rb in honeybadger-5.0.0
- old
+ new
@@ -120,11 +120,13 @@
# @return [false] when ignored.
def notify(exception_or_opts, opts = {})
opts = opts.dup
if exception_or_opts.is_a?(Exception)
- return nil if exception_or_opts.instance_variable_get(:@__hb_handled)
+ already_reported_notice_id = exception_or_opts.instance_variable_get(:@__hb_notice_id)
+ return already_reported_notice_id if already_reported_notice_id
+
opts[:exception] = exception_or_opts
elsif exception_or_opts.respond_to?(:to_hash)
opts.merge!(exception_or_opts.to_hash)
else
opts[:error_message] = exception_or_opts.to_s
@@ -168,9 +170,13 @@
if opts[:sync] || config[:sync]
send_now(notice)
else
push(notice)
+ end
+
+ if exception_or_opts.is_a?(Exception)
+ exception_or_opts.instance_variable_set(:@__hb_notice_id, notice.id) unless exception_or_opts.frozen?
end
notice.id
end