diff options
Diffstat (limited to 'jsonschema/exceptions.py')
-rw-r--r-- | jsonschema/exceptions.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/jsonschema/exceptions.py b/jsonschema/exceptions.py index 149d838..5e88d74 100644 --- a/jsonschema/exceptions.py +++ b/jsonschema/exceptions.py @@ -9,6 +9,7 @@ from textwrap import dedent, indent from typing import ClassVar import heapq import itertools +import warnings import attr @@ -20,6 +21,17 @@ STRONG_MATCHES: frozenset[str] = frozenset() _unset = _utils.Unset() +def __getattr__(name): + if name == "RefResolutionError": + warnings.warn( + _RefResolutionError._DEPRECATION_MESSAGE, + DeprecationWarning, + stacklevel=2, + ) + return _RefResolutionError + raise AttributeError(f"module {__name__} has no attribute {name}") + + class _Error(Exception): _word_for_schema_in_error_message: ClassVar[str] @@ -181,11 +193,17 @@ class SchemaError(_Error): @attr.s(hash=True) -class RefResolutionError(Exception): +class _RefResolutionError(Exception): """ A ref could not be resolved. """ + _DEPRECATION_MESSAGE = ( + "jsonschema.exceptions.RefResolutionError is deprecated as of version " + "4.18.0. If you wish to catch potential reference resolution errors, " + "directly catch referencing.exceptions.Unresolvable." + ) + _cause = attr.ib() def __str__(self): |