use std::io;
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("I/O error: {0}")]
Io(#[from] io::Error),
#[error("HTTP error: {0}")]
Http(#[from] reqwest::Error),
#[error("WebSocket error: {0}")]
WebSocket(#[from] Box<tokio_tungstenite::tungstenite::Error>),
#[error("JSON error: {0}")]
Json(#[from] serde_json::Error),
#[error("API error (status {status}): {message}")]
Api {
status: u16,
message: String,
},
#[error("Failed to start tap process: {message}")]
ProcessStart {
message: String,
},
#[error("Tap process exited with code: {code:?}")]
ProcessExited {
code: Option<i32>,
},
#[error("Event channel closed")]
ChannelClosed,
#[error("WebSocket not available: tap is in webhook mode")]
WebhookModeActive,
#[error("Invalid URL: {0}")]
InvalidUrl(String),
#[error("Operation timed out")]
Timeout,
#[error("URL parse error: {0}")]
UrlParse(#[from] url::ParseError),
#[error("No record present in event")]
NoRecordPresent,
}