@@ -14,12 +14,12 @@ Let’s follow how an error propagates through our blockchain monitoring system:
1414
1515``` rust
1616// Creates basic errors with specific context
17- async fn send_raw_request (... ) -> Result <Value , anyhow :: Error >
17+ async fn send_raw_request (... ) -> Result <Value , anyhow :: Error >
1818 let response = client . post (... )
1919 . await
2020 . map_err (| e | anyhow :: anyhow! (" Failed to send request: {" , e ))? ;
2121
22- if ! status . is_success ()
22+ if ! status . is_success ()
2323 return Err (anyhow :: anyhow! (" HTTP error {: {}" , status , error_body ));
2424 }
2525}
@@ -29,23 +29,23 @@ async fn send_raw_request(...) -> Result<Value, anyhow::Error>
2929
3030``` rust
3131// Adds business context to low-level errors
32- async fn get_transaction_receipt (... ) -> Result <EVMTransactionReceipt , anyhow :: Error >
32+ async fn get_transaction_receipt (... ) -> Result <EVMTransactionReceipt , anyhow :: Error >
3333 let response = self . alloy_client
3434 . send_raw_request (... )
3535 . await
3636 . with_context (|| format! (" Failed to get transaction receipt: {" , tx_hash ))? ;
3737
38- if receipt_data . is_null ()
38+ if receipt_data . is_null ()
3939 return Err (anyhow :: anyhow! (" Transaction receipt not found" ));
40-
40+
4141}
4242```
4343
4444** Filter Layer (` evm/filter.rs ` )**
4545
4646``` rust
4747// Converts to domain-specific errors
48- async fn filter_block (... ) -> Result <Vec <MonitorMatch >, FilterError >
48+ async fn filter_block (... ) -> Result <Vec <MonitorMatch >, FilterError >
4949 let receipts = match futures :: future :: join_all (receipt_futures ). await {
5050 Ok (receipts ) => receipts ,
5151 Err (e ) => {
@@ -77,7 +77,7 @@ ERROR filter_block: openzeppelin_monitor::utils::error: Error occurred,
7777Every error in our system includes detailed context information:
7878
7979``` rust
80- pub struct ErrorContext
80+ pub struct ErrorContext
8181 /// The error message
8282 pub message : String ,
8383 /// The source error (if any)
@@ -154,7 +154,7 @@ async fn filter_block(
154154 _network : & Network ,
155155 block : & BlockType ,
156156 monitors : & [Monitor ],
157- ) -> Result <Vec <MonitorMatch >, FilterError >
157+ ) -> Result <Vec <MonitorMatch >, FilterError >
158158 tracing :: debug! (" Processing block {" , block_number );
159159 // ...
160160}
0 commit comments