Skip to content

Commit c4878c7

Browse files
committed
Capture error after combineLatest
1 parent 5c6ef67 commit c4878c7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/service/BlockService.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
*/
1616

1717
import { sha3_256 } from 'js-sha3';
18-
import { combineLatest, Observable } from 'rxjs';
19-
import { map } from 'rxjs/operators';
18+
import { combineLatest, Observable, of } from 'rxjs';
19+
import { catchError, map } from 'rxjs/operators';
2020
import { BlockRepository } from '../infrastructure/BlockRepository';
2121
import { ReceiptRepository } from '../infrastructure/ReceiptRepository';
2222
import { RepositoryFactory } from '../infrastructure/RepositoryFactory';
@@ -49,7 +49,7 @@ export class BlockService {
4949
const merklePathItemObservable = this.blockRepository.getMerkleTransaction(height, leaf);
5050
return combineLatest(rootHashObservable, merklePathItemObservable).pipe(
5151
map((combined) => this.validateInBlock(leaf, combined[1].merklePath, combined[0].blockTransactionsHash)),
52-
);
52+
).pipe(catchError(() => of(false)));
5353
}
5454

5555
/**
@@ -62,7 +62,7 @@ export class BlockService {
6262
const merklePathItemObservable = this.receiptRepository.getMerkleReceipts(height, leaf);
6363
return combineLatest(rootHashObservable, merklePathItemObservable).pipe(
6464
map((combined) => this.validateInBlock(leaf, combined[1].merklePath, combined[0].blockReceiptsHash)),
65-
);
65+
).pipe(catchError(() => of(false)));
6666
}
6767

6868
/**

0 commit comments

Comments
 (0)