-
-
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_from :all not rescuing all exceptions #1713
Comments
I think we definitely need to update the documentation first, make sure the specs cover all the scenarios, and possibly add a |
I'm willing to try and help. Regarding the documentation, would you like me to remove the |
Whatever you think is appropriate, try something and we can look at it. |
Doc updated in #1725. What do we want to do about this issue? |
I think your |
Yes please @Jelkster |
Is it really documentation problem? What do you think about replacing this line with |
That would make my life easier, as I'm currently in the process of implementing a separate |
I am willing to look at any PR, but this is a pretty major change and it will affect lots of people, so there be dragons. |
@Jelkster Can I send a PR which rescue truly all exceptions? Are you implementing now? |
@mtsmfm go ahead and send it. |
Rebase against #1749. |
@dblock Hi. I have a similar issue. I've tried to add
Any of this doesn't work. I've update Gemfile to use last master commit and started partly work
But
still doesn't care about exceptions like this. I saw from docs that it handle Here is the example of mandrill code: |
These mandrill errors should have been derived from |
@dblock Got it. Thank you for fast response. |
|
@dm1try Yes, it is. It's still mandrill issue |
According to the README, grape can rescue from all exceptions with the following:
I recently stumbled across a case where the wrong method accidentally raised a
NotImplementedError
and caused the web request to hang as a result. I was surprised to see this because I had therescue_from :all
included in the API. I suspected that maybeNotImplementedError
was not aStandardError
and maybe that somehow had something to do with it. Sure enough, I found that it was aScriptError
.I consulted the documentation again to see if I missed something, and actually saw an example of
rescue_from NotImplementedError
in the README. So it appeared as though it was perfectly valid at some point in time. That being said, I also saw the following message below an example: "In this case UserDefinedError must be inherited from StandardError".After taking a look at error.rb it appears as though only
StandardError
will get rescued. I modified the source and replacedStandardError
withException
to see if that would resolve the issue and it did!The last thing I did was inspect the history of the error.rb file to see if it was ever rescuing
Exception
before, and sure enough it was. It appears Rubocop recommended the change.The text was updated successfully, but these errors were encountered: