#[non_exhaustive]pub enum TraceParseError {
LineTooLong {
line: usize,
length: usize,
limit: usize,
},
TooManyEvents {
limit: usize,
},
BlankLine {
line: usize,
},
Malformed {
line: usize,
source: Error,
},
ByteOrderMark,
NotJsonLines {
array: bool,
},
NonMonotonicSeq {
line: usize,
seq: u64,
previous: u64,
},
}Expand description
Why a trace document was rejected. Every variant that addresses one record carries its 1-based line number; the two that describe the document as a whole do not.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
LineTooLong
A line exceeded Limits::max_line_bytes.
Fields
TooManyEvents
The document contains more than Limits::max_events events.
BlankLine
A line was empty (JSON Lines forbids blank records; a single trailing newline is fine).
Malformed
A line was not a valid TraceEvent object.
ByteOrderMark
The document begins with a UTF-8 byte-order mark.
Its own variant because serde reports it as expected value at line 1 column 1, which is true and tells the reader nothing: the offending
bytes are invisible in every editor that wrote them. A BOM is the
commonest way a trace produced on Windows fails to parse — Out-File
and Set-Content have both emitted one by default — and
jq, python -m json.tool and every other tool the reader might reach
for will insist the file is fine.
NotJsonLines
The whole document is a single JSON value: it is JSON, not JSON Lines.
Checked only after a line has already failed, so a valid document never reaches it and the cost is paid once, on the error path. Pretty-printing is the other half of the same mistake as the BOM — a file that is obviously well-formed JSON, rejected with a message about column 1.
NonMonotonicSeq
Event seq values must be strictly increasing in document order.
Trait Implementations§
Source§impl Debug for TraceParseError
impl Debug for TraceParseError
Source§impl Display for TraceParseError
impl Display for TraceParseError
Source§impl Error for TraceParseError
impl Error for TraceParseError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()