-
-
Notifications
You must be signed in to change notification settings - Fork 514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handled Sinatra exceptions still captured #1748
Comments
Perhaps the middleware should be configurable on which http status codes to capture Sinatra exceptions on? |
Can you use Or, do you think there are other Sinatra related features you want to see and it'd be a good idea to have |
We don't want to have to update Add a custom rack middleware that does env.delete('sinatra.error')
env.delete('rack.exception') On "handled" exceptions that should not go to Sentry. E.g. |
@baelter Sorry for the long waiting because I also needed to learn Sinatra first to come up with a solution. I think you should be able to skip handled exceptions with config.before_send = lambda do |event, hint|
handled_errors = Sinatra::Application.errors.keys.grep(Class) # skip status codes
should_skip = false
handled_errors.each do |error|
if hint[:exception].is_a?(error)
should_skip = true
end
end
event unless should_skip
end It'll automatically skip the exceptions that are already registered with the |
Thanks a lot, will consider that! |
@baelter Glad to help. I'm closing this for now 🙂 |
Exceptions handled by Sinatra error blocks. eg.
are still captured by the Sentry Rack middleware.
I think there should at least be a way to disable this.
Looking at the code I think we need to add something to Sinatra so the Sentry middleware can determine if the error is handled or not. As of now
env['sintra.error']
is still set for handled errors. Still opening an issue here first to see what your thoughts are on this.The text was updated successfully, but these errors were encountered: