Skip to content

Inconsistent invalid-enum handling: InstrumentClass warns+defaults, Side/Action throw and kill the stream #35

Description

@tbeason

Line refs are against the registered v0.1.3 tarball. Minor / robustness.

Problem

Invalid enum bytes are handled inconsistently across the decoder:

  • InstrumentClass: warns and defaults — Unknown InstrumentClass value: 116, using OTHER as default (src/types.jl:667)
  • Side / Action: throw ArgumentError: invalid value for Enum Side: 136, killing the entire decode stream

Hit this while debugging the StatMsg misalignment (#1): once the stream desynced, the first bad Side/Action byte aborted everything, masking the real problem. A warn-and-default (or warn-and-skip-record using hd.length) policy for all enums would make the decoder degrade gracefully instead of failing the whole response on one bad byte, and would have made the root cause much easier to spot.

Suggested fix

Pick one policy (warn + sentinel value, or skip the record via hd.length) and apply it uniformly to Side, Action, InstrumentClass, and any other enum reads in the hot path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions