aboutsummaryrefslogtreecommitdiff
path: root/src/message/handshake/mod.rs
diff options
context:
space:
mode:
authorMax Audron <audron@cocaine.farm>2025-02-22 22:59:01 +0100
committerMax Audron <audron@cocaine.farm>2025-02-22 22:59:01 +0100
commitb8ad94cd5061445a45d0790eee36014d34ad6817 (patch)
treefb7d11e136b968d2f2b3593ba9163894baed8912 /src/message/handshake/mod.rs
parentupdate dependencies and fix errors (diff)
replace deprecated failure crate with thiserror
this changes the public API in that all our methods now return a proper ProtocolError crate. Needed change anyways to properly deal with all our errors in the long run. Will still need to do a pass through the crate to remove all existing unwraps where it makes sense.
Diffstat (limited to 'src/message/handshake/mod.rs')
-rw-r--r--src/message/handshake/mod.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/message/handshake/mod.rs b/src/message/handshake/mod.rs
index 029eb86..186abf0 100644
--- a/src/message/handshake/mod.rs
+++ b/src/message/handshake/mod.rs
@@ -24,6 +24,7 @@ pub use protocol::*;
pub use sessioninit::*;
pub use types::*;
+use crate::error::ProtocolError;
use crate::primitive::VariantMap;
use crate::{HandshakeDeserialize, HandshakeSerialize};
@@ -39,7 +40,7 @@ pub enum HandshakeMessage {
}
impl HandshakeSerialize for HandshakeMessage {
- fn serialize(&self) -> Result<Vec<u8>, failure::Error> {
+ fn serialize(&self) -> Result<Vec<u8>, ProtocolError> {
match self {
HandshakeMessage::ClientInit(inner) => inner.serialize(),
HandshakeMessage::ClientInitAck(inner) => inner.serialize(),
@@ -53,7 +54,7 @@ impl HandshakeSerialize for HandshakeMessage {
}
impl HandshakeDeserialize for HandshakeMessage {
- fn parse(b: &[u8]) -> Result<(usize, Self), failure::Error> {
+ fn parse(b: &[u8]) -> Result<(usize, Self), ProtocolError> {
let (size, res) = VariantMap::parse(b)?;
let msgtype: String = (&res["MsgType"]).into();