-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Rescue Child Errors In Error Middleware #544
Conversation
…e children of exceptions as well as the parent given.
I think we should find a better name than Also please update CHANGELOG. |
Yeah, I didn't want to spend a ton of time coming up with a name as I figured someone would come up with a better suggestion anyway, but it does sound hilarious on second look, haha. I would be fine with making it the default, except it might break existing behavior. Someone out there might be rescuing their own error derived from RuntimeError, and RuntimeError too or something like that. This does sound a bit esoteric though. Anyway, there's a unit test to that effect, so I didn't want to break it, but open to what people think. Didn't quite understand the suggestion about inverting the option to Should I also update the README for rescue_from? |
👍 to this. |
I am OK with breaking the default, I think it's a much better default, we just need to bump the major version of Grape and make sure to document this clearly in CHANGELOG as an API change. Lets figure out what a better name for this is. Since the default is going to become rescuing the exception and any child classes of the exceptions, we need a name for the opposite behavior. How about I also like |
Yes, happy new year! It's awesome to even get a chance to contribute to this awesome library in some way, thanks for the quick replies. I'll go ahead then and switch the default, update the CHANGELOG and README. Will also update the above test case since it'll be obsolete. |
…eption classes. Rename children -> subclasses.
Nice job on the README, too. Merged via 268a58d. |
Thanks! One last thing, I made a typo on a test, but should be the last thing on #546 . Sorry about that, and thanks for the fast work! |
Summary
This enables the behavior desired in #542
Assuming this exception hierarchy:
And the following rescue_from calls:
Then the following will be handled by the first handler above.
And the following will all be handled by the second handler.
Notes