1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use crate::snapshot::event::parser;
use crate::snapshot::markers::{DebugMarker, MarkerBytes};
use crate::types::OffsetBytes;
use std::io;
use thiserror::Error;

#[derive(Debug, Error)]
pub enum Error {
    #[error("Invalid marker bytes {1:X?} at offset {0}. Expected {2}")]
    MarkerBytes(OffsetBytes, [u8; 12], MarkerBytes),

    #[error("Invalid debug marker 0x{1:X} at offset {0}. Expected {2}")]
    DebugMarker(OffsetBytes, u32, DebugMarker),

    #[error("Invalid kernel version {1:X?} at offset {0}")]
    KernelVersion(OffsetBytes, [u8; 2]),

    #[error("Found an invalid zero value symbol table index at offset {0}")]
    InvalidSymbolTableIndex(OffsetBytes),

    #[error("User event buffers are not supported (TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER == 1)")]
    UnsupportedUserEventBuffer,

    #[error("16-bit handles are not supported (TRC_CFG_USE_16BIT_OBJECT_HANDLES == 1)")]
    Unsupported16bitHandles,

    #[error(transparent)]
    Parser(#[from] parser::Error),

    #[error(
        "Encountered and IO error while reading the input stream ({})",
        .0.kind()
    )]
    Io(#[from] io::Error),
}