wasi_pg_client/protocol/
error.rs1#[derive(Debug, thiserror::Error)]
2pub enum ProtocolError {
3 #[error("io error: {0}")]
4 Io(#[from] std::io::Error),
5
6 #[error("unexpected EOF")]
7 UnexpectedEof,
8
9 #[error("unknown message type: {0}")]
10 UnknownMessageType(u8),
11
12 #[error("invalid message length")]
13 InvalidLength,
14
15 #[error("utf8 error: {0}")]
16 Utf8(#[from] std::str::Utf8Error),
17
18 #[error("protocol violation: {0}")]
19 ProtocolViolation(String),
20
21 #[error("buffered protocol data exceeded limit: {actual} > {limit} bytes")]
22 BufferLimitExceeded { limit: usize, actual: usize },
23
24 #[error("type error: {0}")]
25 TypeError(String),
26}
27
28impl From<postgres_protocol::message::frontend::BindError> for ProtocolError {
29 fn from(_e: postgres_protocol::message::frontend::BindError) -> Self {
30 ProtocolError::Io(std::io::Error::new(
31 std::io::ErrorKind::InvalidInput,
32 "bind encoding failed",
33 ))
34 }
35}