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

allow custom error responses to be generated #56

Merged
merged 2 commits into from
Sep 25, 2022

Commits on Aug 2, 2022

  1. add a test case for the FLASK_PYDANTIC_VALIDATION_ERROR_STATUS_CODE

    When trying to figure out how to test for a feature using the flask
    config object as a parameter, I couldn't find a test for this feature
    flag being used, so I went ahead and added one.
    jcreekmore committed Aug 2, 2022
    Configuration menu
    Copy the full SHA
    1b5b38a View commit details
    Browse the repository at this point in the history

Commits on Aug 29, 2022

  1. define a config value to allow errors to be raised

    By defining a new config value that flask_pydantic looks for
    (FLASK_PYDANTIC_VALIDATION_ERROR_RAISE), we can support raising an
    exception when we have a validation error. If that is set and the
    exception is raised, by default, Flask will respond with a 500 error.
    However, by coupling that feature with `Flask.register_error_handler`,
    the user can catch the thrown exception and return whatever custom error
    response the user wishes. Fixes bauerji#45.
    jcreekmore committed Aug 29, 2022
    Configuration menu
    Copy the full SHA
    ad0d8ac View commit details
    Browse the repository at this point in the history