1use asterisk_rs_core::error::{AuthError, ConnectionError, ProtocolError, TimeoutError};
4
5#[derive(Debug, thiserror::Error)]
7#[non_exhaustive]
8pub enum AmiError {
9 #[error("connection error: {0}")]
10 Connection(#[from] ConnectionError),
11
12 #[error("authentication error: {0}")]
13 Auth(#[from] AuthError),
14
15 #[error("timeout: {0}")]
16 Timeout(#[from] TimeoutError),
17
18 #[error("protocol error: {0}")]
19 Protocol(#[from] ProtocolError),
20
21 #[error("I/O error: {0}")]
22 Io(#[from] std::io::Error),
23
24 #[error("action failed: {message}")]
25 ActionFailed { action_id: String, message: String },
26
27 #[error("client is disconnected")]
28 Disconnected,
29
30 #[error("action response channel closed")]
31 ResponseChannelClosed,
32
33 #[error("invalid configuration: {details}")]
34 InvalidConfig { details: String },
35}
36
37pub type Result<T> = std::result::Result<T, AmiError>;