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 plugins to catch non ValidationError errors #7806

Merged
merged 1 commit into from Oct 12, 2023
Merged

Conversation

adriangb
Copy link
Member

@adriangb adriangb commented Oct 12, 2023

Selected Reviewer: @Kludex

@@ -58,7 +60,7 @@ class Model(BaseModel, plugin_settings={'observe': 'all'}):

def test_on_validate_json_on_error() -> None:
class CustomOnValidateJson:
def enter(
def on_enter(
Copy link
Member Author

Choose a reason for hiding this comment

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

None of these were getting called 😢. In my opinion, this is a strong argument for using a single method with a context manager instead of multiple optional callbacks.

@adriangb adriangb added relnotes-change Used for changes to existing functionality which don't have a better categorization. relnotes-ignore Omit this PR from the release notes. relnotes-feature and removed relnotes-change Used for changes to existing functionality which don't have a better categorization. relnotes-ignore Omit this PR from the release notes. labels Oct 12, 2023
@adriangb adriangb enabled auto-merge (squash) October 12, 2023 00:16
@adriangb
Copy link
Member Author

please review

@cloudflare-pages
Copy link

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8f84795
Status: ✅  Deploy successful!
Preview URL: https://7fa7231c.pydantic-docs2.pages.dev
Branch Preview URL: https://plugin-on-exception.pydantic-docs2.pages.dev

View logs

@adriangb adriangb merged commit 3f2aaa6 into main Oct 12, 2023
64 of 66 checks passed
@adriangb adriangb deleted the plugin-on-exception branch October 12, 2023 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants