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}, supported {supported:?}")]
24    UnsupportedVersion {
25        found: u32,
26        supported: std::ops::RangeInclusive<u32>,
27    },
28
29    #[error("malformed action {call_id}: {reason}")]
30    MalformedAction { call_id: String, reason: String },
31}
32
33pub type Result<T> = std::result::Result<T, TraceError>;