use zendriver_interception::InterceptionError;
use zendriver_transport::CallError;
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum DataDomeError {
#[error("CAPTCHA surface detected but no solver registered")]
CaptchaRequired,
#[error("CAPTCHA solver failed: {0}")]
CaptchaSolver(Box<dyn std::error::Error + Send + Sync>),
#[error("interception hook error: {0}")]
Interception(#[from] InterceptionError),
#[error("call failed: {0}")]
Call(#[from] CallError),
#[error("JS error: {0}")]
JsError(String),
}
#[cfg(test)]
#[allow(clippy::panic, clippy::unwrap_used)]
mod tests {
use super::*;
#[test]
fn display_captcha_required() {
assert_eq!(
DataDomeError::CaptchaRequired.to_string(),
"CAPTCHA surface detected but no solver registered"
);
}
#[test]
fn display_js_error_passthrough() {
assert_eq!(
DataDomeError::JsError("bad payload".into()).to_string(),
"JS error: bad payload"
);
}
}