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
|
|
@ -1,3 +1,4 @@
|
|||
use crate::handshake::errors::ServerHandshakeError;
|
||||
use crate::message::backend::{
|
||||
AuthenticationOkData, BackendKeyDataData, BackendMessage, ParameterStatusData,
|
||||
ReadyForQueryData,
|
||||
|
|
@ -13,7 +14,7 @@ pub async fn do_server_handshake(
|
|||
name: &str,
|
||||
process: i32,
|
||||
secret: i32,
|
||||
) -> anyhow::Result<StartupMessageData> {
|
||||
) -> Result<StartupMessageData, ServerHandshakeError> {
|
||||
match &reader.peek_special_message().await? {
|
||||
Some(msg @ SpecialMessage::SSLRequest) => {
|
||||
reader.consume_special_message(msg).await?;
|
||||
|
|
@ -31,7 +32,7 @@ pub async fn do_server_handshake(
|
|||
data.clone()
|
||||
}
|
||||
_ => {
|
||||
return Err(anyhow::anyhow!("Expected Startup Message"));
|
||||
return Err(ServerHandshakeError::MissingStartupMessage);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue