1use std::io;
4
5use thiserror::Error;
6
7use crate::proto::ProtoError;
8
9#[derive(Debug, Error)]
11pub enum AgentError {
12 #[error("Agent: Protocol error: {0}")]
14 Proto(#[from] ProtoError),
15
16 #[error("Agent: I/O error: {0}")]
18 IO(#[from] io::Error),
19
20 #[error("Other error: {0:#}")]
22 Other(#[from] Box<dyn std::error::Error + Send + Sync + 'static>),
23
24 #[error("Generic agent extension failure")]
26 ExtensionFailure,
27
28 #[error("Generic agent failure")]
30 Failure,
31}
32
33impl AgentError {
34 pub fn other(error: impl std::error::Error + Send + Sync + 'static) -> Self {
36 Self::Other(Box::new(error))
37 }
38}