refactor(proto): replace anyhow with thiserror in handshake
This commit is contained in:
parent
da6410ce05
commit
165f871324
3 changed files with 25 additions and 2 deletions
21
proto/src/handshake/errors.rs
Normal file
21
proto/src/handshake/errors.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
use thiserror::Error;
|
||||
use tokio::io;
|
||||
use crate::message::errors::ProtoDeserializeError;
|
||||
use crate::reader::errors::{ProtoConsumeError, ProtoPeekError};
|
||||
use crate::writer::errors::ProtoWriteError;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ServerHandshakeError {
|
||||
#[error("startup message not found")]
|
||||
MissingStartupMessage,
|
||||
#[error("reading from socket failed")]
|
||||
Io(#[from] io::Error),
|
||||
#[error("deserialization of inner data failed")]
|
||||
Deserialize(#[from] ProtoDeserializeError),
|
||||
#[error("peeking special message failed")]
|
||||
Peek(#[from] ProtoPeekError),
|
||||
#[error("consuming special message failed")]
|
||||
Consume(#[from] ProtoConsumeError),
|
||||
#[error("writing message to socket failed")]
|
||||
Write(#[from] ProtoWriteError),
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue