Skip to main content

playwright_rs_trace/
error.rs

1//! Error types for trace parsing.
2
3use std::io;
4
5#[derive(Debug, thiserror::Error)]
6pub enum TraceError {
7    #[error("io: {0}")]
8    Io(#[from] io::Error),
9
10    #[error("zip: {0}")]
11    Zip(#[from] zip::result::ZipError),
12
13    #[error("json on line {line}: {source}")]
14    Json {
15        line: usize,
16        #[source]
17        source: serde_json::Error,
18    },
19
20    #[error("missing entry: {0}")]
21    MissingEntry(&'static str),
22
23    #[error("unsupported trace version {found}, expected {expected}")]
24    UnsupportedVersion { found: u32, expected: u32 },
25
26    #[error("malformed action {call_id}: {reason}")]
27    MalformedAction { call_id: String, reason: String },
28}
29
30pub type Result<T> = std::result::Result<T, TraceError>;