wvlet / airframe

Essential Building Blocks for Scala
https://wvlet.org/airframe
Apache License 2.0
631 stars 65 forks source link

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

Open xerial opened 4 years ago

xerial commented 4 years ago

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

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 commented 1 year ago

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.