Skip to content

[C++] Propagate some errors in JSON chunker #14842

@benibus

Description

@benibus

Describe the bug, including details regarding any error messages, version, and platform.

The current JSON Chunker defers all error reporting to a later parsing stage when ParseOptions::newlines_in_values = true. However, this poses issues when sequentially chunking buffers. Consider this:

std::shared_ptr<Buffer> whole, rest;
// Trailing right-bracket
chunker->Process(Buffer::FromString("{\"a\":0}}"), &whole, &rest);

Here, whole will be {"a":0} but rest will be }, which doesn't start a valid JSON block. As such, for the next buffer, you can't then call ProcessWithPartial with rest as its partial argument without crashing (via DCHECK, if enabled). This effectively prevents us from handling the error at all.

Component(s)

C++

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions