File tree Expand file tree Collapse file tree 1 file changed +23
-11
lines changed Expand file tree Collapse file tree 1 file changed +23
-11
lines changed Original file line number Diff line number Diff line change @@ -119,18 +119,30 @@ impl CardanoTransactionParser {
119
119
120
120
let mut blocks = Vec :: new ( ) ;
121
121
for block in hardano_blocks {
122
- // TODO block.unwrap ???
123
- // if let Ok() = decode ???
124
- let block = block. unwrap ( ) ;
125
- if let Ok ( multi_era_block) = MultiEraBlock :: decode ( & block) {
126
- let block = Block :: try_convert ( multi_era_block, immutable_file. number )
127
- . with_context ( || {
128
- format ! (
129
- "CardanoTransactionParser could not read data from block in immutable file: {:?}" ,
122
+ let block = block. map_err ( |e| {
123
+ anyhow ! ( e) . context ( format ! (
124
+ "Error while reading block in immutable file: '{:?}'" ,
125
+ immutable_file. path
126
+ ) )
127
+ } ) ?;
128
+
129
+ match MultiEraBlock :: decode ( & block) {
130
+ Ok ( multi_era_block) => {
131
+ let block = Block :: try_convert ( multi_era_block, immutable_file. number )
132
+ . with_context ( || {
133
+ format ! (
134
+ "CardanoTransactionParser could not read data from block in immutable file: {:?}" ,
135
+ immutable_file. path
136
+ )
137
+ } ) ?;
138
+ blocks. push ( block) ;
139
+ }
140
+ Err ( err) => {
141
+ return Err ( anyhow ! ( err) . context ( format ! (
142
+ "Error while decoding block in immutable file: '{:?}'" ,
130
143
immutable_file. path
131
- )
132
- } ) ?;
133
- blocks. push ( block) ;
144
+ ) ) )
145
+ }
134
146
}
135
147
}
136
148
You can’t perform that action at this time.
0 commit comments