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.
Showing
- changelogs/unreleased/gh-9105-increase-error-serialization-verbosity.md 5 additions, 0 deletions...eleased/gh-9105-increase-error-serialization-verbosity.md
- src/box/lua/config/instance_config.lua 6 additions, 0 deletionssrc/box/lua/config/instance_config.lua
- src/lua/compat.lua 14 additions, 0 deletionssrc/lua/compat.lua
- src/lua/error.lua 49 additions, 3 deletionssrc/lua/error.lua
- src/lua/msgpack.c 3 additions, 3 deletionssrc/lua/msgpack.c
- test/box-luatest/error_subsystem_improvements_test.lua 79 additions, 0 deletionstest/box-luatest/error_subsystem_improvements_test.lua
- test/box/net.box_error_extension_feature.result 7 additions, 11 deletionstest/box/net.box_error_extension_feature.result
- test/box/net.box_error_extension_feature.test.lua 6 additions, 8 deletionstest/box/net.box_error_extension_feature.test.lua
- test/config-luatest/cluster_config_schema_test.lua 1 addition, 0 deletionstest/config-luatest/cluster_config_schema_test.lua
Loading
Please register or sign in to comment