Skip to main content

TraceParseError

Enum TraceParseError 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

LineTooLong

A line exceeded Limits::max_line_bytes.

Fields

§line: usize

1-based line number.

§length: usize

Observed length in bytes.

§limit: usize

The configured cap.

§

TooManyEvents

The document contains more than Limits::max_events events.

Fields

§limit: usize

The configured cap.

§

BlankLine

A line was empty (JSON Lines forbids blank records; a single trailing newline is fine).

Fields

§line: usize

1-based line number.

§

Malformed

A line was not a valid TraceEvent object.

Fields

§line: usize

1-based line number.

§source: Error

The underlying JSON error.

§

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.

Fields

§array: bool

Whether that value is an array, so the message can name the fix.

§

NonMonotonicSeq

Event seq values must be strictly increasing in document order.

Fields

§line: usize

1-based line number.

§seq: u64

The seq on this line.

§previous: u64

The seq on the previous event line.

Trait Implementations§

Source§

impl Debug for TraceParseError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for TraceParseError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for TraceParseError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.