@@ -46,10 +46,13 @@ impl Block {
4646 }
4747
4848 fn get_explorer_block ( & self , db : & ExplorerDB ) -> FieldResult < ExplorerBlock > {
49- db. get_block ( & self . hash ) . wait ( ) ?. ok_or (
50- ErrorKind :: InternalError ( "Couldn't find block's contents in explorer" . to_owned ( ) )
51- . into ( ) ,
52- )
49+ db. get_block ( & self . hash )
50+ . wait ( )
51+ . unwrap_or_else ( |e| match e { } )
52+ . ok_or (
53+ ErrorKind :: InternalError ( "Couldn't find block's contents in explorer" . to_owned ( ) )
54+ . into ( ) ,
55+ )
5356 }
5457}
5558
@@ -283,12 +286,17 @@ impl Transaction {
283286 ) ) ?,
284287 } ;
285288
286- context. db . get_block ( & block_id) . wait ( ) ?. ok_or (
287- ErrorKind :: InternalError (
288- "transaction is in explorer but couldn't find its block" . to_owned ( ) ,
289+ context
290+ . db
291+ . get_block ( & block_id)
292+ . wait ( )
293+ . unwrap_or_else ( |e| match e { } )
294+ . ok_or (
295+ ErrorKind :: InternalError (
296+ "transaction is in explorer but couldn't find its block" . to_owned ( ) ,
297+ )
298+ . into ( ) ,
289299 )
290- . into ( ) ,
291- )
292300 }
293301
294302 fn get_contents ( & self , context : & Context ) -> FieldResult < ExplorerTransaction > {
@@ -444,7 +452,8 @@ impl Address {
444452 let transactions = context
445453 . db
446454 . get_transactions_by_address ( & self . id )
447- . wait ( ) ?
455+ . wait ( )
456+ . unwrap_or_else ( |e| match e { } )
448457 . unwrap_or ( PersistentSequence :: < FragmentId > :: new ( ) ) ;
449458
450459 let boundaries = if transactions. len ( ) > 0 {
@@ -909,7 +918,8 @@ impl Status {
909918 . db
910919 . get_latest_block_hash ( )
911920 . and_then ( |hash| context. db . get_block ( & hash) )
912- . wait ( ) ?
921+ . wait ( )
922+ . unwrap_or_else ( |e| match e { } )
913923 . ok_or ( ErrorKind :: InternalError ( "tip is not in explorer" . to_owned ( ) ) . into ( ) )
914924 . map ( |b| Block :: from ( & b) )
915925 }
@@ -1008,13 +1018,15 @@ impl Epoch {
10081018 . db
10091019 . get_block ( & epoch_data. first_block )
10101020 . map ( |block| u32:: from ( block. expect ( "The block to be indexed" ) . chain_length ) )
1011- . wait ( ) ?;
1021+ . wait ( )
1022+ . unwrap_or_else ( |e| match e { } ) ;
10121023
10131024 let epoch_upper_bound = context
10141025 . db
10151026 . get_block ( & epoch_data. last_block )
10161027 . map ( |block| u32:: from ( block. expect ( "The block to be indexed" ) . chain_length ) )
1017- . wait ( ) ?;
1028+ . wait ( )
1029+ . unwrap_or_else ( |e| match e { } ) ;
10181030
10191031 let boundaries = PaginationInterval :: Inclusive ( InclusivePaginationInterval {
10201032 lower_bound : 0 ,
@@ -1110,7 +1122,8 @@ impl Query {
11101122 Ok ( context
11111123 . db
11121124 . find_block_by_chain_length ( length. try_into ( ) ?)
1113- . wait ( ) ?
1125+ . wait ( )
1126+ . unwrap_or_else ( |e| match e { } )
11141127 . map ( Block :: from_valid_hash) )
11151128 }
11161129
@@ -1127,7 +1140,8 @@ impl Query {
11271140 . db
11281141 . get_latest_block_hash ( )
11291142 . and_then ( |hash| context. db . get_block ( & hash) )
1130- . wait ( ) ?
1143+ . wait ( )
1144+ . unwrap_or_else ( |e| match e { } )
11311145 . ok_or ( ErrorKind :: InternalError (
11321146 "tip is not in explorer" . to_owned ( ) ,
11331147 ) )
0 commit comments