Skip to content

Exceptions

Each of the following exceptions has a token property, referencing the Token that caused the error. You can use Token.position() to get the token's line and column number.

jsonpath.JSONPathError

Bases: Exception

Base exception for all errors.

PARAMETER DESCRIPTION
args

Arguments passed to Exception.

TYPE: object DEFAULT: ()

token

The token that caused the error.

TYPE: Optional[Token] DEFAULT: None

jsonpath.JSONPathSyntaxError

Bases: JSONPathError

An exception raised when parsing a JSONPath string.

PARAMETER DESCRIPTION
args

Arguments passed to Exception.

TYPE: object DEFAULT: ()

token

The token that caused the error.

TYPE: Token

jsonpath.JSONPathTypeError

Bases: JSONPathError

An exception raised due to a type error.

This should only occur at when evaluating filter expressions.

jsonpath.JSONPathIndexError

Bases: JSONPathError

An exception raised when an array index is out of range.

PARAMETER DESCRIPTION
args

Arguments passed to Exception.

TYPE: object DEFAULT: ()

token

The token that caused the error.

TYPE: Token

jsonpath.JSONPathNameError

Bases: JSONPathError

An exception raised when an unknown function extension is called.

PARAMETER DESCRIPTION
args

Arguments passed to Exception.

TYPE: object DEFAULT: ()

token

The token that caused the error.

TYPE: Token

jsonpath.JSONPointerError

Bases: Exception

Base class for all JSON Pointer errors.

jsonpath.JSONPointerEncodeError

Bases: JSONPointerError

An exception raised when a JSONPathMatch can't be encoded to a JSON Pointer.

jsonpath.JSONPointerResolutionError

Bases: JSONPointerError

Base exception for those that can be raised during pointer resolution.

jsonpath.JSONPointerIndexError

Bases: JSONPointerResolutionError, IndexError

An exception raised when an array index is out of range.

jsonpath.JSONPointerKeyError

Bases: JSONPointerResolutionError, KeyError

An exception raised when a pointer references a mapping with a missing key.

jsonpath.JSONPointerTypeError

Bases: JSONPointerResolutionError, TypeError

An exception raised when a pointer resolves a string against a sequence.

jsonpath.RelativeJSONPointerError

Bases: Exception

Base class for all Relative JSON Pointer errors.

jsonpath.RelativeJSONPointerIndexError

Bases: RelativeJSONPointerError

An exception raised when modifying a pointer index out of range.

jsonpath.RelativeJSONPointerSyntaxError

Bases: RelativeJSONPointerError

An exception raised when we fail to parse a relative JSON Pointer.

jsonpath.JSONPatchError

Bases: Exception

Base class for all JSON Patch errors.

jsonpath.JSONPatchTestFailure

Bases: JSONPatchError

An exception raised when a JSON Patch test op fails.