Module error

Source
Expand description

Error handling utils.

The Tarantool error handling works most like libc’s errno. All API calls return -1 or NULL in the event of error. An internal pointer to box_error_t type is set by API functions to indicate what went wrong. This value is only significant if API call failed (returned -1 or NULL).

Successful function can also touch the last error in some cases. You don’t have to clear the last error before calling API functions. The returned object is valid only until next call to any API function.

You must set the last error using set_error() in your stored C procedures if you want to return a custom error message. You can re-throw the last API error to IPROTO client by keeping the current value and returning -1 to Tarantool from your stored procedure.

Structs§

BoxError
Structured info about an error which can happen as a result of an internal API or a remote procedure call.

Enums§

EncodeError
Error that can happen when serializing a tuple
Error
Represents all error cases for all routines of crate (including Tarantool errors)
TarantoolErrorCode
Codes of Tarantool errors

Traits§

IntoBoxError
Types implementing this trait represent an error which can be converted to a structured tarantool internal error. In simple cases this may just be an conversion into an error message, but may also add an error code and/or additional custom fields. (custom fields not yet implemented).

Functions§

clear_error
Clear the last error.
set_last_error
Sets the last tarantool error. The file_line specifies source location to be set for the error. If it is None, the location of the caller is used (see std::panic::Location::caller for details on caller location).

Type Aliases§

EncodeDeprecated
Result
A specialized Result type for the crate
TarantoolError
TimeoutError