1use std::net::SocketAddr;
2use thiserror::Error;
3
4#[derive(Debug, Error)]
5#[non_exhaustive]
6pub enum MockServerError {
7 #[error("Failed to bind to address {addr}: {source}")]
8 BindError {
9 addr: SocketAddr,
10 #[source]
11 source: std::io::Error,
12 },
13
14 #[error("Server task panicked")]
15 ServerPanic(#[from] tokio::task::JoinError),
16
17 #[error("Failed to parse protobuf request: {0}")]
18 ProtobufParseError(#[from] prost::DecodeError),
19
20 #[error("Failed to parse JSON request: {0}")]
21 JsonParseError(#[from] serde_json::Error),
22
23 #[error("Failed to encode response: {0}")]
24 EncodeError(String),
25
26 #[error("Server error: {0}")]
27 ServerError(String),
28
29 #[error("Timed out after {0:?} waiting for condition")]
30 WaitTimeout(std::time::Duration),
31}