Skip to content
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

Configure exception class whitelist to be reraised by operations processors. #290

Merged
merged 2 commits into from
Jul 6, 2015

Conversation

barelyknown
Copy link
Collaborator

For example, if you use Pundit for authorization, you might
raise a Pundit::NotAuthorizedError at some point during operations
processing. If you want to use Rails' rescue_from macro to
catch this error and render a 403 status code, you should add
the Pundit::NotAuthorizedError to the exception_class_whitelist.

JSONAPI.configuration.exception_class_whitelist = [Pundit::NotAuthorizedError]

…essors.

For example, if you use Pundit for authorization, you might
raise a Pundit::NotAuthorizedError at some point during operations
processing. If you want to use Rails' `rescue_from` macro to
catch this error and render a 403 status code, you should add
the `Pundit::NotAuthorizedError` to the `exception_class_whitelist`.

`JSONAPI.configuration.exception_class_whitelist = [Pundit::NotAuthorizedError]`
lgebhardt added a commit that referenced this pull request Jul 6, 2015
Configure exception class whitelist to be reraised by operations processors.
@lgebhardt lgebhardt merged commit 9b5d171 into cerebris:master Jul 6, 2015
@lgebhardt
Copy link
Member

Thanks! This adds some nice flexibility that was inadvertently lost with the InternalServer error change.

@barelyknown
Copy link
Collaborator Author

I agree. It's nice to gracefully rescue internal server errors, but having the option to raise/rescue some classes is pretty important in my experience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants