zendriver_datadome/
error.rs1use zendriver_interception::InterceptionError;
4use zendriver_transport::CallError;
5
6#[derive(Debug, thiserror::Error)]
13#[non_exhaustive]
14pub enum DataDomeError {
15 #[error("CAPTCHA surface detected but no solver registered")]
17 CaptchaRequired,
18
19 #[error("CAPTCHA solver failed: {0}")]
21 CaptchaSolver(Box<dyn std::error::Error + Send + Sync>),
22
23 #[error("interception hook error: {0}")]
25 Interception(#[from] InterceptionError),
26
27 #[error("call failed: {0}")]
29 Call(#[from] CallError),
30
31 #[error("JS error: {0}")]
33 JsError(String),
34}
35
36#[cfg(test)]
37#[allow(clippy::panic, clippy::unwrap_used)]
38mod tests {
39 use super::*;
40
41 #[test]
42 fn display_captcha_required() {
43 assert_eq!(
44 DataDomeError::CaptchaRequired.to_string(),
45 "CAPTCHA surface detected but no solver registered"
46 );
47 }
48
49 #[test]
50 fn display_js_error_passthrough() {
51 assert_eq!(
52 DataDomeError::JsError("bad payload".into()).to_string(),
53 "JS error: bad payload"
54 );
55 }
56}