-
Notifications
You must be signed in to change notification settings - Fork 46
Support box.error #245
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
Merged
DifferentialOrange
merged 6 commits into
master
from
DifferentialOrange/gh-232-error-type
Oct 31, 2022
Merged
Support box.error #245
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1045cb0
setup: clarify Python versions
DifferentialOrange 249e1e8
deps: backport dataclasses for Python 3.6
DifferentialOrange cd6a62a
api: ConnectionPool support for Python 3.6
DifferentialOrange 40d6ce8
msgpack: improve unknown ext type error message
DifferentialOrange 1c202d1
iproto: support errors extra information
DifferentialOrange 951aa1a
msgpack: support error extension type
DifferentialOrange File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module :py:mod:`tarantool.types` | ||
================================ | ||
|
||
.. automodule:: tarantool.types |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
msgpack>=1.0.4 | ||
pandas | ||
pytz | ||
dataclasses; python_version <= '3.6' |
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
""" | ||
Tarantool `error`_ extension type support module. | ||
|
||
Refer to :mod:`~tarantool.msgpack_ext.types.error`. | ||
|
||
.. _error: https://www.tarantool.io/en/doc/latest/dev_guide/internals/msgpack_extensions/#the-error-type | ||
""" | ||
|
||
from tarantool.types import ( | ||
encode_box_error, | ||
decode_box_error, | ||
) | ||
|
||
EXT_ID = 3 | ||
""" | ||
`error`_ type id. | ||
""" | ||
|
||
def encode(obj, packer): | ||
""" | ||
Encode an error object. | ||
|
||
:param obj: Error to encode. | ||
:type obj: :class:`tarantool.BoxError` | ||
|
||
:param packer: msgpack packer to encode error dictionary. | ||
:type packer: :class:`msgpack.Packer` | ||
|
||
:return: Encoded error. | ||
:rtype: :obj:`bytes` | ||
""" | ||
|
||
err_map = encode_box_error(obj) | ||
return packer.pack(err_map) | ||
|
||
def decode(data, unpacker): | ||
""" | ||
Decode an error object. | ||
|
||
:param obj: Error to decode. | ||
:type obj: :obj:`bytes` | ||
|
||
:param unpacker: msgpack unpacker to decode error dictionary. | ||
:type unpacker: :class:`msgpack.Unpacker` | ||
|
||
:return: Decoded error. | ||
:rtype: :class:`tarantool.BoxError` | ||
""" | ||
|
||
unpacker.feed(data) | ||
err_map = unpacker.unpack() | ||
return decode_box_error(err_map) |
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.