Skip to content

Commit

Permalink
Allow subclass to override middleware's exception capturing method
Browse files Browse the repository at this point in the history
  • Loading branch information
st0012 committed Dec 27, 2020
1 parent 3c688c4 commit c1018f8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sentry-ruby/lib/sentry/rack/capture_exceptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ def call(env)
finish_span(span, 500)
raise # Don't capture Sentry errors
rescue Exception => e
Sentry.capture_exception(e)
capture_exception(e)
finish_span(span, 500)
raise
end

exception = collect_exception(env)
Sentry.capture_exception(exception) if exception
capture_exception(exception) if exception

finish_span(span, response[0])

Expand All @@ -53,6 +53,10 @@ def finish_span(span, status_code)
span.set_http_status(status_code)
span.finish
end

def capture_exception(exception)
Sentry.capture_exception(exception)
end
end
end
end

0 comments on commit c1018f8

Please sign in to comment.