Skip to content

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

@xerial

Description

@xerial

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions