Exceptions¶
-
class
jsl.exceptions.SchemaGenerationException(message)[source]¶ Raised when a valid JSON schema can not be generated from a JSL object.
Examples of such situation are the following:
- A
variableresolves to an integer but aBaseFieldexpected; - All choices of
OneOfFieldare variables and all resolve toNone.
Note: this error can only happen if variables are used in a document or field description.
Parameters: message (str) – A message. -
message= None¶ A message.
- A
Steps¶
Steps attached to a SchemaGenerationException serve as a traceback
and help a user to debug the error in the document or field description.
-
class
jsl.exceptions.Step(entity, role='default')[source]¶ A step of the schema generation process that caused the error.
Parameters: - entity – An entity being processed.
- role (str) – A current role.
-
entity= None¶ An entity being processed.
-
role= None¶ A current role.
-
class
jsl.exceptions.DocumentStep(entity, role='default')[source]¶ Bases:
jsl.exceptions.StepA step of processing a
document.Parameters: - entity (subclass of
Document) – An entity being processed. - role (str) – A current role.
- entity (subclass of
-
class
jsl.exceptions.FieldStep(entity, role='default')[source]¶ Bases:
jsl.exceptions.StepA step of processing a
field.Parameters: - entity (instance of
BaseField) – An entity being processed. - role (str) – A current role.
- entity (instance of
-
class
jsl.exceptions.AttributeStep(entity, role='default')[source]¶ Bases:
jsl.exceptions.StepA step of processing an attribute of a field.
entityis the name of an attribute (e.g.,"properties","additional_properties", etc.)Parameters: - entity (str) – An entity being processed.
- role (str) – A current role.
-
class
jsl.exceptions.ItemStep(entity, role='default')[source]¶ Bases:
jsl.exceptions.StepA step of processing an item of an attribute.
entityis either a key or an index (e.g., it can be"created_at"if the current attribute ispropertiesof aDictFieldor0if the current attribute isitemsof aArrayField).Parameters: - entity (str or int) – An entity being processed.
- role (str) – A current role.