You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because the middleware checks only for a list of classes in rescuable?(klass) and the Child class is not included in the list, it will never rescue this.
Is there a way to have all ParentError-derivative classes be rescued?
The text was updated successfully, but these errors were encountered:
You can always rescue :all and re-raise an error. But I think we should extend the behavior of rescue_from to allow your scenario. I am not sure what syntax it takes, but I would take a pull request that makes it possible without breaking existing functionality.
Ah, indeed, my fault. My example should have included also other rescue_from for other exceptions such as Grape::Exceptions::ValidationErrors, the idea being to separate different classes of errors. This would be specifically for errors of application-level origin (the API).
Awesome, I'll work on a pull request to enable this.
Suppose you have an error hierarchy as below:
In the API file, suppose you then attempt to rescue from all errors in a standard way:
Now suppose a Child error is raised:
Because the middleware checks only for a list of classes in rescuable?(klass) and the Child class is not included in the list, it will never rescue this.
Is there a way to have all ParentError-derivative classes be rescued?
The text was updated successfully, but these errors were encountered: