Exceptions

Exceptions used by the Yangson library.

This module defines the following exceptions:

exception yangson.exceptions.AnnotationException(path: str)

Bases: yangson.exceptions.YangsonException

Abstract class for exceptions related to metadata annotations.

exception yangson.exceptions.AnnotationTypeError(path: str, aname: str, msg: str)

Bases: yangson.exceptions.AnnotationException

Type of annotation is incorrect.

exception yangson.exceptions.BadSchemaNodeType(qn: Tuple[str, str], expected: str)

Bases: yangson.exceptions.SchemaNodeException

A schema node is of a wrong type.

exception yangson.exceptions.BadYangLibraryData(message: str)

Bases: yangson.exceptions.YangsonException

Broken YANG library data.

exception yangson.exceptions.CyclicImports

Bases: yangson.exceptions.YangsonException

YANG modules are imported in a cyclic fashion.

exception yangson.exceptions.DefinitionNotFound(kw: str, name: str)

Bases: yangson.exceptions.YangsonException

Requested definition does not exist.

exception yangson.exceptions.EndOfInput(parser: Parser)

Bases: yangson.exceptions.ParserException

Unexpected end of input.

exception yangson.exceptions.FeaturePrerequisiteError(name: str, ns: str)

Bases: yangson.exceptions.YangsonException

Pre-requisite feature is not supported.

exception yangson.exceptions.InstanceException(instance: InstanceNode, message: str)

Bases: yangson.exceptions.YangsonException

Abstract class for exceptions related to operations on instance nodes.

exception yangson.exceptions.InstanceValueError(instance: InstanceNode, message: str)

Bases: yangson.exceptions.InstanceException

The instance value is incompatible with the called method.

exception yangson.exceptions.InvalidArgument(arg: str)

Bases: yangson.exceptions.YangsonException

The argument of a statement is invalid.

exception yangson.exceptions.InvalidFeatureExpression(parser: Parser)

Bases: yangson.exceptions.ParserException

Invalid if-feature expression.

exception yangson.exceptions.InvalidKeyValue(value: Union[int, decimal.Decimal, str, Tuple[None]])

Bases: yangson.exceptions.YangsonException

List key or leaf-list value is invalid.

exception yangson.exceptions.InvalidLeafrefPath(qn: Tuple[str, str])

Bases: yangson.exceptions.SchemaNodeException

A leafref path is incorrect.

exception yangson.exceptions.InvalidSchemaPath(path: str)

Bases: yangson.exceptions.YangsonException

Invalid schema or data path.

exception yangson.exceptions.InvalidXPath(parser: Parser)

Bases: yangson.exceptions.ParserException

Exception to be raised for an invalid XPath expression.

exception yangson.exceptions.MissingAnnotationTarget(path: str, iname: str)

Bases: yangson.exceptions.AnnotationException

Instance node that is being annotated doesn’t exist.

exception yangson.exceptions.MissingModule(name: str, rev: str = '')

Bases: yangson.exceptions.YangsonException

Abstract exception class – a module is missing.

exception yangson.exceptions.MissingModuleNamespace(ns: str)

Bases: yangson.exceptions.YangsonException

Abstract exception class – a module is missing.

exception yangson.exceptions.ModuleContentMismatch(found: str, expected: str)

Bases: yangson.exceptions.YangsonException

Abstract exception class – unexpected module name or revision.

exception yangson.exceptions.ModuleNameMismatch(found: str, expected: str)

Bases: yangson.exceptions.ModuleContentMismatch

Parsed module revision doesn’t match the expected revision.

exception yangson.exceptions.ModuleNotFound(name: str, rev: str = '')

Bases: yangson.exceptions.MissingModule

A module or submodule registered in YANG library is not found.

exception yangson.exceptions.ModuleNotImplemented(name: str, rev: str = '')

Bases: yangson.exceptions.MissingModule

A module is not implemented in the data model.

exception yangson.exceptions.ModuleNotImported(mod: str, mid: Tuple[str, str])

Bases: yangson.exceptions.YangsonException

Module is not imported.

exception yangson.exceptions.ModuleNotRegistered(name: str, rev: str = '')

Bases: yangson.exceptions.MissingModule

A module is not registered in YANG library.

exception yangson.exceptions.ModuleRevisionMismatch(found: str, expected: str)

Bases: yangson.exceptions.ModuleContentMismatch

Parsed module revision doesn’t match the expected revision.

exception yangson.exceptions.MultipleImplementedRevisions(module: str)

Bases: yangson.exceptions.YangsonException

A module has multiple implemented revisions.

exception yangson.exceptions.NonDataNode(instance: InstanceNode, message: str)

Bases: yangson.exceptions.InstanceException

Attempt to access an instance of non-data node (rpc/action/notification).

exception yangson.exceptions.NonexistentInstance(instance: InstanceNode, message: str)

Bases: yangson.exceptions.InstanceException

Attempt to access an instance node that doesn’t exist.

exception yangson.exceptions.NonexistentSchemaNode(qn: Tuple[str, str], name: str, ns: Optional[str] = None)

Bases: yangson.exceptions.SchemaNodeException

A schema node doesn’t exist.

exception yangson.exceptions.NotSupported(parser: Parser, feature: str)

Bases: yangson.exceptions.ParserException

Exception to be raised for unimplemented XPath features.

exception yangson.exceptions.ParserException(parser: Parser)

Bases: yangson.exceptions.YangsonException

Base class for parser exceptions.

exception yangson.exceptions.RawDataError(path: str)

Bases: yangson.exceptions.YangsonException

Abstract exception class for errors in raw data.

exception yangson.exceptions.RawMemberError(path: str)

Bases: yangson.exceptions.RawDataError

Object member in the raw value doesn’t exist in the schema.

exception yangson.exceptions.RawTypeError(path: str, expected: str)

Bases: yangson.exceptions.RawDataError

Raw value is of an incorrect type.

exception yangson.exceptions.SchemaError(instance: InstanceNode, tag: str, message: str = None)

Bases: yangson.exceptions.ValidationError

An instance violates a schema constraint.

exception yangson.exceptions.SchemaNodeException(qn: Tuple[str, str])

Bases: yangson.exceptions.YangsonException

Abstract exception class for schema node errors.

exception yangson.exceptions.SemanticError(instance: InstanceNode, tag: str, message: str = None)

Bases: yangson.exceptions.ValidationError

An instance violates a semantic rule.

exception yangson.exceptions.StatementNotFound(parent: str, kw: str)

Bases: yangson.exceptions.YangsonException

Required statement does not exist.

exception yangson.exceptions.UndefinedAnnotation(path: str, aname: str)

Bases: yangson.exceptions.AnnotationException

Undefined annotation is used.

exception yangson.exceptions.UnexpectedInput(parser: Parser, expected: str = None)

Bases: yangson.exceptions.ParserException

Unexpected input.

exception yangson.exceptions.UnknownPrefix(prefix: str, mid: Tuple[str, str])

Bases: yangson.exceptions.YangsonException

Unknown namespace prefix.

exception yangson.exceptions.ValidationError(instance: InstanceNode, tag: str, message: str = None)

Bases: yangson.exceptions.YangsonException

Abstract exception class for instance validation errors.

exception yangson.exceptions.XPathTypeError(value: str)

Bases: yangson.exceptions.YangsonException

The value of an XPath (sub)expression is of a wrong type.

exception yangson.exceptions.YangTypeError(instance: InstanceNode, tag: str, message: str = None)

Bases: yangson.exceptions.ValidationError

A scalar value doesn’t match its expected type.

exception yangson.exceptions.YangsonException

Bases: Exception

Base class for all Yangson exceptions.

Error Tags

Exceptions related to validity of instance documents, i.e. instances of the SchemaError and SemanticError classes, have the tag attribute containing a semi-formal string identifying the specific error condition.

Below is the list of error tags used by the Yangson library. Some of them are defined in sec. 15 of [RFC7950] but Yangson also introduces a number of error tags on its own. Furthermore, error tags specific to a concrete data model can be defined using the error-app-tag statement in YANG, see sec. 7.5.4.2 of [RFC7950]. If they are present in the data model, Yangson also uses them.

data-not-unique

A unique constraint is violated, see sec. 7.8.3 of [RFC7950].

instance-required

An required instance referred to by a leafref or instance-identifier leaf is missing.

invalid-type

A leaf or leaf-list value has invalid type.

list-key-missing

A key instance is missing in a list entry.

member-not-allowed

An object member is not permitted by the schema.

missing-data

Data required by the schema are missing.

must-violation

A must constraint is violated, see sec. 7.5.3 of [RFC7950].

non-unique-key

Key values of a list instance are not unique.

repeated-leaf-list-values

Values of a leaf-list instance representing configuration are not unique.

too-few-elements

A min-elements constraint is violated, see sec. 7.7.5 of [RFC7950].

too-many-elements

A max-elements constraint is violated, see sec. 7.7.6 of [RFC7950].