Skip to content

Commit 5247896

Browse files
Error handling
1 parent c787b27 commit 5247896

File tree

1 file changed

+3
-11
lines changed
  • rust/rbac-registration/src/cardano/cip509

1 file changed

+3
-11
lines changed

rust/rbac-registration/src/cardano/cip509/cip509.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
use std::{borrow::Cow, collections::HashMap};
66

7-
use anyhow::anyhow;
7+
use anyhow::{anyhow, Context};
88
use cardano_blockchain_types::{MultiEraBlock, TxnIndex};
99
use catalyst_types::{
1010
hashes::{Blake2b256Hash, BLAKE_2B256_SIZE},
@@ -149,16 +149,8 @@ impl Cip509 {
149149
payment_history,
150150
report: &mut report,
151151
};
152-
let cip509 = match Cip509::decode(&mut decoder, &mut decode_context) {
153-
Ok(v) => v,
154-
Err(e) => {
155-
// We should get here only if we were unable to decode even the first byte.
156-
decode_context
157-
.report
158-
.other(&format!("{e:?}"), "Failed to decode Cip509");
159-
return Ok(Some(Self::with_decode_context(&decode_context)));
160-
},
161-
};
152+
let cip509 =
153+
Cip509::decode(&mut decoder, &mut decode_context).context("Failed to decode Cip509")?;
162154

163155
// Perform the validation.
164156
if let Some(txn_inputs_hash) = &cip509.txn_inputs_hash {

0 commit comments

Comments
 (0)