From e63ecc10aa426e3aba416fd05a3f568d719a79a3 Mon Sep 17 00:00:00 2001 From: Max Audron Date: Sat, 21 Feb 2026 17:25:52 +0100 Subject: handshare and signalproxy/rpccall error handling --- src/message/handshake/clientloginreject.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/message/handshake/clientloginreject.rs') diff --git a/src/message/handshake/clientloginreject.rs b/src/message/handshake/clientloginreject.rs index c4f09cc..300bc2e 100644 --- a/src/message/handshake/clientloginreject.rs +++ b/src/message/handshake/clientloginreject.rs @@ -21,10 +21,15 @@ impl HandshakeSerialize for ClientLoginReject { } } -impl From for ClientLoginReject { - fn from(mut input: VariantMap) -> Self { - ClientLoginReject { - error: input.remove("ErrorString").unwrap().try_into().unwrap(), - } +impl TryFrom for ClientLoginReject { + type Error = ProtocolError; + + fn try_from(mut input: VariantMap) -> Result { + Ok(ClientLoginReject { + error: input + .remove("ErrorString") + .ok_or_else(|| ProtocolError::MissingField("ErrorString".to_string()))? + .try_into()?, + }) } } -- cgit v1.2.3