fix: wrap db.get in a try/catch
This commit is contained in:
parent
0a66d78298
commit
b578a32a44
|
@ -137,7 +137,12 @@ export class S5Node {
|
||||||
hash: Multihash,
|
hash: Multihash,
|
||||||
): Promise<Map<number, Map<NodeId, Map<number, any>>>> {
|
): Promise<Map<number, Map<NodeId, Map<number, any>>>> {
|
||||||
const map = new Map<number, Map<NodeId, Map<number, any>>>();
|
const map = new Map<number, Map<NodeId, Map<number, any>>>();
|
||||||
const bytes = await this.db.get(stringifyHash(hash));
|
let bytes;
|
||||||
|
try {
|
||||||
|
bytes = await this.db.get(stringifyHash(hash));
|
||||||
|
} catch {
|
||||||
|
return map;
|
||||||
|
}
|
||||||
if (bytes === null) {
|
if (bytes === null) {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue