Sentry-ruby: Rescued Exceptions not being sent

Created on 17 Aug 2017  路  4Comments  路  Source: getsentry/sentry-ruby

Hello,

From reading the docs, I get the idea that exceptions would be sent to Sentry regardless of whether they were rescued or not(i.e the middleware would hand it off to Sentry). Is this true? If so, I'm not able to see rescued exceptions getting sent over, and I was wondering if there are certain conditions under which this wouldn't work, and what those are?

Thanks!

question

Most helpful comment

Good to know, thanks.

All 4 comments

What do you mean by rescue? Do you mean rescue_from in Rails or just rescue in Ruby, i.e.:

begin
rescue
end

I was referring to the latter, just rescuing within Ruby.

It's impossible for us to capture an exception inside a rescue block, because it never bubbles up any further. You have two options: you can re-raise in the rescue block, or use Raven.capture_exception:

```ruby
begin
raise "Uh oh"
rescue Exception => e
Raven.capture_exception(e)
end

Good to know, thanks.

Was this page helpful?
0 / 5 - 0 ratings