Skip to content
Snippets Groups Projects
Commit cc7af2eb authored by Georgiy Lebedev's avatar Georgiy Lebedev Committed by Serge Petrenko
Browse files

lua: increase error serialization verbosity

Currently, the error object's `__serialize` metamethod and the Lua
serializer only display the `message` field omitting all other potentially
useful fields.

Let's call the error object's `__serialize` metamethod from the Lua
serializer and call `error:unpack` from the `__serialize` metamethod to
display all other error object fields. This will transparently allow to
display the whole error stack (i.e., the cause chain).

Let's make the error object's  `__tostring` metamethod return the `message`
field followed by a whitespace and the rest of the fields encoded to JSON.
Let's print the error stack (i.e., the cause chain) on separate lines.

Since this change may potentially break existing users, let's add a new
`box_error_serialize_verbose` option to `compat` to retain old behavior,
and disable the new behaviour by default. Let's also retain the old
behaviour for the MsgPack serializers unconditionally.

Closes #9105

@TarantoolBot document
Title: Document increased error serialization verbosity
Product: Tarantool
Since: 3.1
Root documents: https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_error/
and https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_error/error
and https://tarantool.io/compat/box_error_serialize_verbose

[Link to the design document](https://www.notion.so/tarantool/Error-subsystem-improvements-90faa0a4714b4143abaf8bed2c10b2fc?pvs=4#072087684e094ea28cba88002236178a)

Please add a new https://tarantool.io/compat/box_error_serialize_verbose
page for the `box_error_serialize_verbose` compatibility option.
parent 5e13b02a
No related branches found
No related tags found
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