module tarantool.types

Additional Tarantool type definitions.

class tarantool.types.BoxError(type: Union[str, bytes], file: Union[str, bytes], line: int, message: Union[str, bytes], errno: int, errcode: int, fields: Optional[dict] = None, prev: Optional[List[BoxError]] = None)

Type representing Tarantool box.error object: a single MP_ERROR_STACK object with a link to the previous stack error.

errcode: int

Number of the error as defined in errcode.h.

errno: int

Ordinal number of the error.

fields: Optional[dict] = None

Additional fields depending on error type. For example, if type is "AccessDeniedError", then it will include "object_type", "object_name", "access_type".

file: Union[str, bytes]

Source code file where error was caught.

Value type depends on Connection encoding.

line: int

Line number in source code file.

message: Union[str, bytes]

Text of reason.

Value type depends on Connection encoding.

prev: Optional[List[BoxError]] = None

Previous error in stack.

type: Union[str, bytes]

Type that implies source, for example "ClientError".

Value type depends on Connection encoding.

tarantool.types.decode_box_error(err_map)

Decode MessagePack map received from Tarantool to box.error object representation.

Parameters:

err_map (dict) – Error MessagePack map received from Tarantool.

Return type:

BoxError

Raises:

KeyError

tarantool.types.encode_box_error(err)

Encode Python box.error representation to MessagePack map.

Parameters:

err (tarantool.BoxError) – Error to encode

Return type:

dict

Raises:

KeyError