-
Notifications
You must be signed in to change notification settings - Fork 129
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
Trace exception rescuing with ExceptionTracer? #246
Comments
No supports. |
I see 👍 |
Now there is no support but we can consider about it. |
For
|
I got this idea from debugging this issue: getsentry/sentry-ruby#1563 In this case, the exception is raised from a middleware but it doesn't surface to the target middleware From the above information, I can know that:
I can quickly rule out a few of the suspected middlewares by looking at their names. But I still need to check several of them's implementation to figure this out (which is my job today 😂 ). So if the ExceptionTracer can also point out where is the exception get rescued, it'll save me a lot of work. |
Ah, it can be separated locations... I understand the situation. |
When developing Rails applications, I rarely see this kind of issues (probably once or twice a year). It's usually caused by a bad rescue statement written years ago and can easily be spotted by search for But as a gem maintainer that supports multiple versions of Rails, it happens more frequently. I think I've dealt with similar issues for four or five times since this year. And it's always painful to track down an exception this way 🥲 |
For this particular task, I think my gem object_tracer does a bit better than the debugger. It has a method called
So I used Perhaps we can have something similar to this like Of course, the common use case of the method is not to track multiple instances at once. It's to trace instances that aren't easily accessible (like exceptions) with their classes. |
|
@ko1 |
In addition to seeing where an exception is raised, it'll also help a lot to know when an exception is rescued. This will be very useful for debugging Rails applications or Rack middlewares. In these applications, rescue/re-raise exceptions based on different options is common. For example: https://github.com/rails/rails/blob/main/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb#L36-L40
So it'd really help if
ExceptionTracer
can also trace rescuing events. But I'm not sure if this would be technically possible when such events are not supported byTracePoint
?The text was updated successfully, but these errors were encountered: