Skip to content
Snippets Groups Projects
Commit eb2c6a4a authored by Ilya Verbin's avatar Ilya Verbin Committed by Serge Petrenko
Browse files

box/lua: allow to set custom error payload fields

See the docbot request for details.

Closes #9104

@TarantoolBot document
Title: Document custom error payload fields
Product: Tarantool
Since: 3.1
Root documents: https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_error/new/
and https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_error/error/

Since Tarantool 3.1 it is possible to add a custom payload to the error on
error construction. The payload is passed as key-value pairs, where `key`
is a string, and `value` is any Lua object. The key name can be arbitrary
except it should not be the same as any of the built-in error field name:
reason, code, type, base_type, custom_type, errno, message, prev, trace.

NO_WRAP
Replace:
box.error.new({ reason = string[, code = number, type = string] }])
with:
box.error.new({ reason = string[, code = number, type = string, key1 = value1, ...] }])

Replace:
box.error({ reason = string[, code = number, type = string] }])
with:
box.error({ reason = string[, code = number, type = string, key1 = value1, ...] }])
NO_WRAP
parent a2b736b8
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment