-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
api: support errors extended information and error type in MessagePack #229
Conversation
39e6c7e
to
4dde607
Compare
d1f025b
to
596820a
Compare
9ae0e98
to
a49bcd3
Compare
c0d28bc
to
0d431a6
Compare
33d0483
to
999cf4a
Compare
08ff8fe
to
e06592f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do rebase to master
.
e06592f
to
87fe913
Compare
cbd40c2
to
e6c5a3f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch! I finally checked all dots at the ends of the comments. =)
There are just a couple of non-critical conversations to resolve.
0ee60e3
to
ae90ad5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also cherry-pick the commit:
8cb6489
Since 2.4.1 IPROTO_ERROR (0x31) is renamed to IPROTO_ERROR_24 and IPROTO_ERROR name is used for 0x52 constant describing extended error info [1]. 1. https://www.tarantool.io/en/doc/latest/dev_guide/internals/msgpack_extensions/#the-error-type Part of #209
Since Tarantool 2.4.1, iproto error responses contain extended info with backtrace [1]. After this patch, Error would contain ExtendedInfo field (BoxError object), if it was provided. Error() handle now will print extended info, if possible. 1. https://www.tarantool.io/en/doc/latest/dev_guide/internals/box_protocol/#responses-for-errors Part of #209
Tarantool supports error extension type since version 2.4.1 [1], encoding was introduced in Tarantool 2.10.0 [2]. This patch introduces the support of Tarantool error extension type in msgpack decoders and encoders. Tarantool error extension type objects are decoded to `*tarantool.BoxError` type. `*tarantool.BoxError` may be encoded to Tarantool error extension type objects. Error extension type internals are the same as errors extended information: the only difference is that extra information is encoded as a separate error dictionary field and error extension type objects are encoded as MessagePack extension type objects. The only way to receive an error extension type object from Tarantool is to receive an explicitly built `box.error` object: either from `return box.error.new(...)` or a tuple with it. All errors raised within Tarantool (including those raised with `box.error(...)`) are encoded based on the same rules as simple errors due to backward compatibility. It is possible to create error extension type objects with Go code, but it not likely to be really useful since most of their fields is computed on error initialization on the server side (even for custom error types). This patch also adds ErrorExtensionFeature flag to client protocol features list. Without this flag, all `box.error` object sent over iproto are encoded to string. We behave like Tarantool `net.box` here: if we support the feature, we provide the feature flag. Since it may become too complicated to enable/disable feature flag through import, error extension type is available as a part of the base package, in contrary to Decimal, UUID, Datetime and Interval types which are enabled by importing underscore subpackage. 1. tarantool/tarantool#4398 2. tarantool/tarantool#6433 Closes #209
ae90ad5
to
11970e1
Compare
Cherry-picked. What's about tarantool/setup-tarantool#37 ? |
To be honest, I wasn't looking for a solution yet (quickfix |
Quickfix is |
Thank you, it works: |
Merge after #226
code health: rename error iproto code
Since 2.4.1 IPROTO_ERROR (0x31) is renamed to IPROTO_ERROR_24 and IPROTO_ERROR name is used for 0x52 constant describing extended error info [1].
Part of #209
api: support errors extended information
Since Tarantool 2.4.1, iproto error responses contain extended info with backtrace [1]. After this patch, Error would contain ExtendedInfo field (BoxError object), if it was provided. Error() handle now will print extended info, if possible.
Part of #209
api: support error type in MessagePack
Tarantool supports error extension type since version 2.4.1 [1], encoding was introduced in Tarantool 2.10.0 [2]. This patch introduces the support of Tarantool error extension type in msgpack decoders and encoders.
Tarantool error extension type objects are decoded to
*tarantool.BoxError
type.*tarantool.BoxError
may be encoded top Tarantool error extension type objects.Error extension type internals are the same as errors extended information: the only difference is that extra information is encoded as a separate error dictionary field and error extension type objects are encoded as MessagePack extension type objects.
The only way to receive an error extension type object from Tarantool is to receive an explicitly built
box.error
object: either fromreturn box.error.new(...)
or a tuple with it. All errors raised within Tarantool (including those raised withbox.error(...)
) are encoded based on the same rules as simple errors due to backward compatibility.It is possible to create error extension type objects with Go code, but it not likely to be really useful since most of their fields is
computed on error initialization on the server side (even for custom error types).
This patch also adds ErrorExtensionFeature flag to client protocol features list. Without this flag, all
box.error
object sent overiproto are encoded to string. We behave like Tarantool
net.box
here: if we support the feature, we provide the feature flag.Since it may become too complicated to enable/disable feature flag through import, error extension type is available as a part of the base package, in contrary to Decimal, UUID, Datetime and Interval types which are enabled by importing underscore subpackage.
Closes #209
I didn't forget about: