lua: increase error serialization verbosity#9716
Merged
sergepetrenko merged 2 commits intotarantool:masterfrom Mar 11, 2024
Merged
lua: increase error serialization verbosity#9716sergepetrenko merged 2 commits intotarantool:masterfrom
sergepetrenko merged 2 commits intotarantool:masterfrom
Conversation
75507d5 to
8d5718e
Compare
andreyaksenov
approved these changes
Feb 20, 2024
5910118 to
2ed6b5a
Compare
2ed6b5a to
1dd7152
Compare
Totktonada
reviewed
Feb 23, 2024
Totktonada
reviewed
Feb 23, 2024
Totktonada
reviewed
Feb 23, 2024
4c29eb8 to
98927c4
Compare
nshy
requested changes
Mar 1, 2024
4195a53 to
0ec7dbb
Compare
0ec7dbb to
3717f5a
Compare
e449b63 to
1c29178
Compare
817dbf0 to
897f6f3
Compare
nshy
approved these changes
Mar 5, 2024
Currently, we delegate the work of serializing extensions to serializers in case of known extensions. In case of unknown extensions we try to convert them from Lua using the serialization and string conversion metamethods. However, there are cases where we would prefer to do the serialization in Lua instead of delegating to serializers. Let's always try to serialize extensions first using Lua via `luaL_convertfield`, and, if it fails, or the conversion returns an extension again, fallback to the serializers. Needed for tarantool#9105 NO_CHANGELOG=<refactoring> NO_DOC=<refactoring> NO_TEST=<refactoring>
35dadd2 to
2afa268
Compare
Totktonada
reviewed
Mar 7, 2024
Totktonada
reviewed
Mar 7, 2024
Totktonada
reviewed
Mar 7, 2024
Totktonada
reviewed
Mar 7, 2024
Totktonada
approved these changes
Mar 7, 2024
Contributor
Totktonada
left a comment
There was a problem hiding this comment.
It seems, our serialization framework hardly fits our serialization needs. This pull request pushes it to the limit, but is has to.
I've no objections here.
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 tarantool#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.
2afa268 to
fda40fd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This patch increases error serialization verbosity.
Closes #9105