error_object
-
object
error_object
¶ An object that defines an error.
error_object
is returned by the following methods:-
error_object:
unpack
()¶ Get error details that may include an error code, type, message, and trace.
Example
box.error.last():unpack() --[[ --- - code: 500 base_type: CustomError type: CustomInternalError custom_type: CustomInternalError message: Internal server error trace: - file: '[string "custom_error = box.error.new({ code = 500,..."]' line: 1 ... --]]
-
error_object:
raise
()¶ Raise the current error.
See also: Raising an error
-
error_object:
set_prev
(error_object)¶ Since: 2.4.1
Set the previous error for the current one.
Параметры: - body (
error_object
) – an error object
See also: Error lists
- body (
-
error_object.
prev
¶ Since: 2.4.1
Get the previous error for the current one.
Rtype: error_object See also: Error lists
-
error_object.
code
¶ The error code. This attribute may return a custom error code or a Tarantool error code.
Rtype: number
-
error_object.
type
¶ The error type.
Rtype: string See also: Custom error
-
error_object.
message
¶ The error message.
Rtype: string
-
error_object.
trace
¶ The error trace.
Rtype: table
-
error_object.
errno
¶ If the error is a system error (for example, a socket or file IO failure), returns a C standard error number.
Rtype: number
-
error_object.
reason
¶ Since: 2.10.0
Returns the box.info.ro_reason value at the moment of throwing the
box.error.READONLY
error.The following values may be returned:
election
if the instance has box.cfg.election_mode set to a value other thanoff
and this instance is not a leader. In this case,error_object
may include the following attributes:state
,leader_id
,leader_uuid
, andterm
.synchro
if the synchronous queue has an owner that is not the given instance. This error usually happens if synchronous replication is used and another instance is called box.ctl.promote(). In this case,error_object
may include thequeue_owner_id
,queue_owner_uuid
, andterm
attributes.config
if the box.cfg.read_only is set totrue
.orphan
if the instance is in the orphan state.
Примечание
If multiple reasons are true at the same time, then only one is returned in the following order of preference:
election
,synchro
,config
,orphan
.Rtype: string
-
error_object.
state
¶ Since: 2.10.0
For the
box.error.READONLY
error, returns the current state of a replica set node in regards to leader election (see box.info.election.state). This attribute presents if the error reason iselection
.Rtype: string
-
error_object.
leader_id
¶ Since: 2.10.0
For the
box.error.READONLY
error, returns a numeric identifier (box.info.id) of the replica set leader. This attribute may present if the error reason iselection
.Rtype: number
-
error_object.
leader_uuid
¶ Since: 2.10.0
For the
box.error.READONLY
error, returns a globally unique identifier (box.info.uuid) of the replica set leader. This attribute may present if the error reason iselection
.
-
error_object.
queue_owner_id
¶ Since: 2.10.0
For the
box.error.READONLY
error, returns a numeric identifier (box.info.id) of the synchronous queue owner. This attribute may present if the error reason issynchro
.Rtype: number
-
error_object.
queue_owner_uuid
¶ Since: 2.10.0
For the
box.error.READONLY
error, returns a globally unique identifier (box.info.uuid) of the synchronous queue owner. This attribute may present if the error reason issynchro
.
-
error_object.
term
¶ Since: 2.10.0
For the
box.error.READONLY
error, returns the current election term (see box.info.election.term). This attribute may present if the error reason iselection
orsynchro
.
-