@@ -46,10 +46,13 @@ impl Block {
46
46
}
47
47
48
48
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
+ )
53
56
}
54
57
}
55
58
@@ -283,12 +286,17 @@ impl Transaction {
283
286
) ) ?,
284
287
} ;
285
288
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 ( ) ,
289
299
)
290
- . into ( ) ,
291
- )
292
300
}
293
301
294
302
fn get_contents ( & self , context : & Context ) -> FieldResult < ExplorerTransaction > {
@@ -444,7 +452,8 @@ impl Address {
444
452
let transactions = context
445
453
. db
446
454
. get_transactions_by_address ( & self . id )
447
- . wait ( ) ?
455
+ . wait ( )
456
+ . unwrap_or_else ( |e| match e { } )
448
457
. unwrap_or ( PersistentSequence :: < FragmentId > :: new ( ) ) ;
449
458
450
459
let boundaries = if transactions. len ( ) > 0 {
@@ -909,7 +918,8 @@ impl Status {
909
918
. db
910
919
. get_latest_block_hash ( )
911
920
. and_then ( |hash| context. db . get_block ( & hash) )
912
- . wait ( ) ?
921
+ . wait ( )
922
+ . unwrap_or_else ( |e| match e { } )
913
923
. ok_or ( ErrorKind :: InternalError ( "tip is not in explorer" . to_owned ( ) ) . into ( ) )
914
924
. map ( |b| Block :: from ( & b) )
915
925
}
@@ -1008,13 +1018,15 @@ impl Epoch {
1008
1018
. db
1009
1019
. get_block ( & epoch_data. first_block )
1010
1020
. map ( |block| u32:: from ( block. expect ( "The block to be indexed" ) . chain_length ) )
1011
- . wait ( ) ?;
1021
+ . wait ( )
1022
+ . unwrap_or_else ( |e| match e { } ) ;
1012
1023
1013
1024
let epoch_upper_bound = context
1014
1025
. db
1015
1026
. get_block ( & epoch_data. last_block )
1016
1027
. map ( |block| u32:: from ( block. expect ( "The block to be indexed" ) . chain_length ) )
1017
- . wait ( ) ?;
1028
+ . wait ( )
1029
+ . unwrap_or_else ( |e| match e { } ) ;
1018
1030
1019
1031
let boundaries = PaginationInterval :: Inclusive ( InclusivePaginationInterval {
1020
1032
lower_bound : 0 ,
@@ -1110,7 +1122,8 @@ impl Query {
1110
1122
Ok ( context
1111
1123
. db
1112
1124
. find_block_by_chain_length ( length. try_into ( ) ?)
1113
- . wait ( ) ?
1125
+ . wait ( )
1126
+ . unwrap_or_else ( |e| match e { } )
1114
1127
. map ( Block :: from_valid_hash) )
1115
1128
}
1116
1129
@@ -1127,7 +1140,8 @@ impl Query {
1127
1140
. db
1128
1141
. get_latest_block_hash ( )
1129
1142
. and_then ( |hash| context. db . get_block ( & hash) )
1130
- . wait ( ) ?
1143
+ . wait ( )
1144
+ . unwrap_or_else ( |e| match e { } )
1131
1145
. ok_or ( ErrorKind :: InternalError (
1132
1146
"tip is not in explorer" . to_owned ( ) ,
1133
1147
) )
0 commit comments