trace_recorder_parser/streaming/
error.rs1use crate::streaming::entry_table::{Entry, EntryStates};
2use crate::streaming::event::{EventId, EventParameterCount};
3use crate::types::{Endianness, FormattedStringError, ObjectHandle};
4use std::io;
5use thiserror::Error;
6
7#[derive(Debug, Error)]
8pub enum Error {
9 #[error("Invalid kernel version {0:X?}")]
10 KernelVersion([u8; 2]),
11
12 #[error("Invalid PSF endianness identifier {0:X?}")]
13 PSFEndiannessIdentifier(u32),
14
15 #[error("Encountered a trace restart PSF endianness identifier ({0:?})")]
16 TraceRestarted(Endianness),
17
18 #[error(
19 "Entry table symbol size must be greater than {} (TRC_ENTRY_TABLE_SLOT_SYMBOL_SIZE)",
20 Entry::MIN_SYMBOL_SIZE
21 )]
22 InvalidEntryTableSymbolSize,
23
24 #[error(
25 "Entry table state count must be greater than or equal to {} (TRC_ENTRY_TABLE_STATE_COUNT)",
26 EntryStates::NUM_STATES
27 )]
28 InvalidEntryTableStateCount,
29
30 #[error("Event ID {0} expects {1} parameters but reported having {2}")]
31 InvalidEventParameterCount(EventId, usize, EventParameterCount),
32
33 #[error("TsConfig event contains an invalid timer counter type {0}")]
34 InvalidTimerCounter(u32),
35
36 #[error("Found an event with object handle {0} that doesn't exist in the entry table")]
37 ObjectLookup(ObjectHandle),
38
39 #[error("Found a fixed user event with format string handle {0} that doesn't exist in the entry table")]
40 FixedUserEventFmtStringLookup(ObjectHandle),
41
42 #[error("Found an event ({0}) with an invalid zero value object handle")]
43 InvalidObjectHandle(EventId),
44
45 #[error(transparent)]
46 FormattedString(#[from] FormattedStringError),
47
48 #[error(
49 "Encountered and IO error while reading the input stream ({})",
50 .0.kind()
51 )]
52 Io(#[from] io::Error),
53}