Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

airframe-codec: Clarify error handling of MessageCodec.unpack #1162

Open
xerial opened this issue Jun 28, 2020 · 1 comment
Open

airframe-codec: Clarify error handling of MessageCodec.unpack #1162

xerial opened this issue Jun 28, 2020 · 1 comment

Comments

@xerial
Copy link
Member

xerial commented Jun 28, 2020

We need to clarify the error handling and assumption in MessageCodec[A] implementations

  • MessageCodec.unpack should proceed the cursor as least by one regardless whether the input MessagePack Value can be parsed as A or not
  • If the input MessagePack value can be parsed as A, move forward the cursor and call MessageContext.setXXX.
  • If the input MessagePack value cannot be encoded into A, skip reading the value (by proceeding the cursor) and call MessageContext.setNil, setError, setIncompatibleFormatError to report parsing failure.

Enforcing these rules may make the implementation complicated (especially handling unknown exceptions), so in this case we need to introduce a common error handling method which preserve the initial cursor position in MessagePack buffer. If any error is found, rollback the cursor and skip the input value.

@xerial xerial mentioned this issue Dec 4, 2020
90 tasks
@xerial
Copy link
Member Author

xerial commented Dec 1, 2022

A second thought about this problem is instead of supporting streaming support, airframe-coded should focus on managing the small sizes of data like gRPC/protocol buffer. This will simplify the design a lot.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants