Skip to content

Commit

Permalink
Add cursed match statement for protocol errors
Browse files Browse the repository at this point in the history
  • Loading branch information
HCastano committed Dec 19, 2024
1 parent b785279 commit 3d88af1
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions crates/threshold-signature-server/src/helpers/signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,26 @@ pub async fn do_signing(

match result {
Ok(_) => (),
Err(ProtocolErr::ConnectionError { source: _, account_id: _ }) => {
todo!()
Err(e)
if matches!(
e,
ProtocolErr::ConnectionError { .. }
| ProtocolErr::EncryptedConnection { .. }
| ProtocolErr::BadSubscribeMessage { .. }
| ProtocolErr::Subscribe { .. }
) =>
{
let _account_id = match e {
ProtocolErr::ConnectionError { ref account_id, .. } => account_id,
ProtocolErr::EncryptedConnection { ref account_id, .. } => account_id,
ProtocolErr::BadSubscribeMessage { ref account_id, .. } => account_id,
ProtocolErr::Subscribe { ref account_id, .. } => account_id,
_ => unreachable!(),
}.clone();

return Err(e);
},
// Err(ProtocolErr::EncryptedConnection(_)) => todo!(),
// Err(ProtocolErr::BadSubscribeMessage(_)) => todo!(),
// Err(ProtocolErr::Subscribe(_)) => todo!(),
_ => todo!(),
Err(e) => return Err(e),
}

let channels = {
Expand Down

0 comments on commit 3d88af1

Please sign in to comment.