Skip to content

More graceful handling of invalid timestamps - #119

Merged
flamble merged 1 commit into
bloomberg:mainfrom
flamble:decode-timestamp
Nov 24, 2026
Merged

flamble merged 1 commit into
bloomberg:mainfrom
flamble:decode-timestamp

Conversation

@flamble

@flamble flamble commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Problem statement

A timestamp that is not a valid bdlt::Datetime failed the decode of the whole content header, which Framer::appendFrame reported as a channel exception and Connection escalated to a connection level syntax error.

Proposed changes

Handle it as the unsupported DECIMAL field value already is: consume the field so that whatever follows it still decodes, log the error, and leave the value unset. decodeTimestamp takes a
bsl::optional<bdlt::Datetime> and returns false only when the field could not be read, which is the case that leaves the read position meaningless, so a truncated read is still a decode failure.

### Problem statement

A timestamp that is not a valid `bdlt::Datetime` failed the decode of
the whole content header, which `Framer::appendFrame` reported as a
channel exception and `Connection` escalated to a connection level
syntax error.

### Proposed changes

Handle it as the unsupported `DECIMAL` field value already is: consume
the field so that whatever follows it still decodes, log the error, and
leave the value unset. `decodeTimestamp` takes a
`bsl::optional<bdlt::Datetime>` and returns false only when the field
could not be read, which is the case that leaves the read position
meaningless, so a truncated read is still a decode failure.
@flamble
flamble enabled auto-merge (squash) November 24, 2026 11:10
@flamble
flamble merged commit 44d39d4 into bloomberg:main Nov 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants