zendriver_interception/
error.rs1#[derive(Debug, thiserror::Error)]
11#[non_exhaustive]
12pub enum InterceptionError {
13 #[error("call failed: {0}")]
14 Call(Box<zendriver_transport::CallError>),
15
16 #[error("invalid url pattern: {0}")]
17 InvalidPattern(String),
18
19 #[error("interception already started")]
20 AlreadyStarted,
21
22 #[error("interception not started")]
23 NotStarted,
24
25 #[error("subscription channel closed")]
26 SubscriptionClosed,
27
28 #[error("invalid response from CDP: {0}")]
29 InvalidResponse(String),
30}
31
32impl From<zendriver_transport::CallError> for InterceptionError {
33 fn from(e: zendriver_transport::CallError) -> Self {
34 Self::Call(Box::new(e))
35 }
36}
37
38#[cfg(test)]
39#[allow(clippy::panic, clippy::unwrap_used)]
40mod tests {
41 use super::*;
42
43 #[test]
44 fn display_invalid_pattern() {
45 let e = InterceptionError::InvalidPattern("**bad".into());
46 assert_eq!(e.to_string(), "invalid url pattern: **bad");
47 }
48}