From 1f6b9bdabef6f33257362670bc33191d11805196 Mon Sep 17 00:00:00 2001 From: Luis Herasme Date: Fri, 26 Jul 2024 15:40:54 -0400 Subject: [PATCH] refactor: Use ".expect" instead of ".unwrap()" inside ghost-crab-macros --- ghost-crab-macros/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ghost-crab-macros/src/lib.rs b/ghost-crab-macros/src/lib.rs index 6a44e63..c20d993 100644 --- a/ghost-crab-macros/src/lib.rs +++ b/ghost-crab-macros/src/lib.rs @@ -24,7 +24,7 @@ pub fn block_handler(metadata: TokenStream, input: TokenStream) -> TokenStream { panic!("The source is missing"); } - let config = config::load().unwrap(); + let config = config::load().expect("config.json not found"); let _ = config.block_handlers.get(name).expect("BlockHandler not found in the config.json"); let name = Literal::string(name); @@ -101,7 +101,7 @@ fn get_context_identifier(parsed: ItemFn) -> Ident { fn create_handler(metadata: TokenStream, input: TokenStream, is_template: bool) -> TokenStream { let (name, event_name) = get_source_and_event(metadata); - let config = config::load().unwrap(); + let config = config::load().expect("config.json not found"); let abi = if is_template { let source = config.templates.get(&name).expect("Source not found."); @@ -141,7 +141,7 @@ fn create_handler(metadata: TokenStream, input: TokenStream, is_template: bool) let decoded_log = #ctx .log .log_decode::<#contract_name::#event_name>() - .unwrap(); + .expect("Error decoding log data"); let event = decoded_log.data();