Skip to content

Commit

Permalink
Clearer error on invalid Plugin (#8023)
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin committed Nov 6, 2023
1 parent 85f5d93 commit cde3779
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pydantic/plugin/_schema_validator.py
Expand Up @@ -70,9 +70,12 @@ def __init__(
json_event_handlers: list[BaseValidateHandlerProtocol] = []
strings_event_handlers: list[BaseValidateHandlerProtocol] = []
for plugin in plugins:
p, j, s = plugin.new_schema_validator(
schema, schema_type, schema_type_path, schema_kind, config, plugin_settings
)
try:
p, j, s = plugin.new_schema_validator(
schema, schema_type, schema_type_path, schema_kind, config, plugin_settings
)
except TypeError as e: # pragma: no cover
raise TypeError(f'Error using plugin `{plugin.__module__}:{plugin.__class__.__name__}`: {e}') from e
if p is not None:
python_event_handlers.append(p)
if j is not None:
Expand Down

0 comments on commit cde3779

Please sign in to comment.