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

fix error handler #200

Closed
wants to merge 1 commit into from
Closed

Conversation

mozartilize
Copy link

make sure Api does not eat exceptions which don't have error handler register to Api.
make it play nicer with other extensions like Flask-JWT-Extended

refs:

make sure Api does not eat exceptions which don't have error handler register Api.
make it plays nicer with other extensions like Flask-JWT-Extended

refs:
- vimalloc/flask-jwt-extended#86
- noirbizarre/flask-restplus#340
@mozartilize
Copy link
Author

Seems like Api need to be wrapped in a blueprint which has a default error handler to response to application/json

Copy link
Contributor

@avilaton avilaton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what this change does, could you please elaborate?

@@ -651,12 +651,9 @@ def handle_error(self, e):

# When propagate_exceptions is set, do not return the exception to the
# client if a handler is configured for the exception.
if (
not isinstance(e, HTTPException)
and current_app.propagate_exceptions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is propagate exceptions being removed here

Copy link
Author

@mozartilize mozartilize Aug 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want all exeptions if not handled by restx return to flask, therefore some extensions like flask-jwt-extended can work properly. I think the purpose of propagate_exceptions is for testing and debugging and if someone want to use it, they must be enduser, not library.

I see that restx's design is make the whole application for api only - by catch all exceptions and response to json, but what if i want the route /api to only handle api and the rest serves html?

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