trace_recorder_parser/snapshot/
error.rs

1use crate::snapshot::event::parser;
2use crate::snapshot::markers::{DebugMarker, MarkerBytes};
3use crate::types::OffsetBytes;
4use std::io;
5use thiserror::Error;
6
7#[derive(Debug, Error)]
8pub enum Error {
9    #[error("Invalid marker bytes {1:X?} at offset {0}. Expected {2}")]
10    MarkerBytes(OffsetBytes, [u8; 12], MarkerBytes),
11
12    #[error("Invalid debug marker 0x{1:X} at offset {0}. Expected {2}")]
13    DebugMarker(OffsetBytes, u32, DebugMarker),
14
15    #[error("Invalid kernel version {1:X?} at offset {0}")]
16    KernelVersion(OffsetBytes, [u8; 2]),
17
18    #[error("Found an invalid zero value symbol table index at offset {0}")]
19    InvalidSymbolTableIndex(OffsetBytes),
20
21    #[error("User event buffers are not supported (TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER == 1)")]
22    UnsupportedUserEventBuffer,
23
24    #[error("16-bit handles are not supported (TRC_CFG_USE_16BIT_OBJECT_HANDLES == 1)")]
25    Unsupported16bitHandles,
26
27    #[error(transparent)]
28    Parser(#[from] parser::Error),
29
30    #[error(
31        "Encountered and IO error while reading the input stream ({})",
32        .0.kind()
33    )]
34    Io(#[from] io::Error),
35}