1use thiserror::Error;
2
3#[derive(Error, Debug)]
5pub enum WaitHumanError {
6 #[error("Request timed out after {elapsed_seconds:.1} seconds")]
8 Timeout { elapsed_seconds: f64 },
9
10 #[error("Network error: {0}")]
12 NetworkError(#[from] reqwest::Error),
13
14 #[error("Failed to create confirmation: {status_text}")]
16 CreateFailed { status_text: String },
17
18 #[error("Failed to poll for answer: {status_text}")]
20 PollFailed { status_text: String },
21
22 #[error("Unexpected answer type: expected {expected}, got {actual}")]
24 UnexpectedAnswerType { expected: String, actual: String },
25
26 #[error("Invalid selected index: {index}")]
28 InvalidSelectedIndex { index: u32 },
29
30 #[error("Invalid response from server: {0}")]
32 InvalidResponse(String),
33}
34
35pub type Result<T> = std::result::Result<T, WaitHumanError>;