]>
jfr.im git - dlqueue.git/blob - venv/lib/python3.11/site-packages/setuptools/config/_validate_pyproject/fastjsonschema_exceptions.py
4 SPLIT_RE
= re
.compile(r
'[\.\[\]]+')
7 class JsonSchemaException(ValueError):
9 Base exception of ``fastjsonschema`` library.
13 class JsonSchemaValueException(JsonSchemaException
):
15 Exception raised by validation function. Available properties:
17 * ``message`` containing human-readable information what is wrong (e.g. ``data.property[index] must be smaller than or equal to 42``),
18 * invalid ``value`` (e.g. ``60``),
19 * ``name`` of a path in the data structure (e.g. ``data.property[index]``),
20 * ``path`` as an array in the data structure (e.g. ``['data', 'property', 'index']``),
21 * the whole ``definition`` which the ``value`` has to fulfil (e.g. ``{'type': 'number', 'maximum': 42}``),
22 * ``rule`` which the ``value`` is breaking (e.g. ``maximum``)
23 * and ``rule_definition`` (e.g. ``42``).
25 .. versionchanged:: 2.14.0
26 Added all extra properties.
29 def __init__(self
, message
, value
=None, name
=None, definition
=None, rule
=None):
30 super().__init
__(message
)
31 self
.message
= message
34 self
.definition
= definition
39 return [item
for item
in SPLIT_RE
.split(self
.name
) if item
!= '']
42 def rule_definition(self
):
43 if not self
.rule
or not self
.definition
:
45 return self
.definition
.get(self
.rule
)
48 class JsonSchemaDefinitionException(JsonSchemaException
):
50 Exception raised by generator of validation function.