Skip to main content

spdy_mux/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum Error {
5    #[error("invalid SPDY frame: {0}")]
6    InvalidFrame(&'static str),
7
8    #[error("zlib compression error: {0}")]
9    Compression(String),
10
11    #[error("stream {0} not found")]
12    StreamNotFound(u32),
13
14    #[error("stream {0} reset by peer: status {1}")]
15    StreamReset(u32, u32),
16
17    #[error("mux closed")]
18    MuxClosed,
19
20    #[error("SYN_REPLY timeout for stream {0}")]
21    SynReplyTimeout(u32),
22
23    #[error("i/o error: {0}")]
24    Io(#[from] std::io::Error),
25
26    #[error("capacity exhausted: {in_use} active pairs, limit {limit}")]
27    CapacityExhausted { in_use: usize, limit: u32 },
28
29    #[error("stream ID space exhausted (last valid: {0})")]
30    StreamIdExhausted(u32),
31
32    #[error("frame too large on stream {stream_id}: {size} bytes exceeds max {max}")]
33    FrameTooLarge {
34        stream_id: u32,
35        size: usize,
36        max: u32,
37    },
38
39    #[error("GOAWAY received: last_good_stream={last_good_stream_id}, status={status}")]
40    GoAway {
41        last_good_stream_id: u32,
42        status: u32,
43    },
44
45    #[error("ping timeout: no response within {0:?}")]
46    PingTimeout(std::time::Duration),
47
48    #[error("idle timeout: no frames received for {0:?}")]
49    IdleTimeout(std::time::Duration),
50
51    #[error("transport error: {0}")]
52    Transport(#[from] crate::transport::TransportError),
53}