-
-
Notifications
You must be signed in to change notification settings - Fork 520
Only capture handled exceptions if they are 5xx and handled by default handler #370
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there are a reason to change this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep - latest version of RSpec doesn't allow you to specify an error class when expecting a block to_not raise an error.
What happens if someone uses a different handler? For example, would this break with a gem like |
|
If someone's written their own exceptions app they probably know what they're doing and can explicitly send errors to Sentry if they want to. For example, at GoCardless we provide a JSON API. If someone gives us bad JSON it will throw a params parser error when Rails tries to handle it. We catch that in our exceptions app and turn it into a 400 with details of where the bad JSON was. I don't want Sentry to tell me whenever that happens, and don't want to have to exclude dozens of errors. However, if our exception app doesn't know what to do with the error then we do want to send it to sentry, and we do that explicitly. |
|
@nateberkopec - updated. |
I don't think this is a user experience I'm comfortable with. Changing your exception application should not break your exception reporting.
We could make if configuration[:excluded_exceptions].any? do |x|
x.to_s!
x == exc.class.name || exc.class.ancestors.any? { |a| x == a.class.name }
end
# obviously clean that up a bit, but you get the ideaThat way you could add YourApp::JSONSyntax to the list and have all of your exceptions inherit from that base class (which you may already be doing anyway). |
|
Sounds like we're coming at this from very different angles. As I see it:
In the re-raise case we'll already bubble-up to the Adding all non-5xx error classes from Finally, it's worth noting that |
|
I agree to some extent with the feedback here, but I dont have any input around that really. I think this should be possible: We have this issue on other platforms where you couldn't reliably bubble a 500 up to a user without the global error handler catching it, thus you'd leave the logging up to that point (where you have less control and information). |
|
@nateberkopec - what do you reckon? Happy to closed if you're not convinced! We're working around this now by deleting the Up to you! |
|
@greysteil I think I still don't fully understand the problem the whole way.
Couldn't we fix this by changing the middleware order? If your exceptions app came after ("lower" in the stack) than the Raven Rack middleware, wouldn't your exception app EDIT: This is the default middleware order. I think we're discussing an unintended side effect of #343, see below. |
|
The point of #343, which introduced this problem for you, was really, I think, to report exceptions in development by default. You're encountering your issue in production. I think there's a better solution here that accommodates both use cases. |
|
Agree that changing the middleware order isn't the solution. Would it be worth tagging @robertclancy in to understand exactly what behaviour he was looking for in #343? There's quite a lot of literature about Rails exception apps, of which I think this is the best, and I'm pretty sure we don't want to report exceptions that have been explicitly dealt with in any environment. |
|
The intention of https://github.com/getsentry/raven-ruby/pull/343 was to capture non-rails exceptions in production that had been handled by ShowExceptions. The unintended part of that was to capture exceptions such as Should |
|
OK, cool. We don't want to add all of the keys in |
6809be8 to
cd2f174
Compare
|
@greysteil I think you should disable our debug/show exceptions integration and then deal with whatever behavior you want to implement in your own exception application. After I merge #422, the following will work for you: Raven.configure do |config|
config.catch_debugged_exceptions = false
endCurrently it doesn't, because we still manually inspect Would that work for you? |
|
👍 works perfectly. Closing this in favour of that PR. |
This is an attempt to make https://github.com/getsentry/raven-ruby/pull/343 less noisy.
The Rails
ShowExceptionsclass wraps exceptions and calls a handler to decide what to do with them. The default hander is thePublicExceptionsclass. We only want to send exceptions to sentry by default when that default handler hasn't been overwritten (by setting anexceptions_appother thanPublicExceptions).