fix: wrap db.get in a try/catch

This commit is contained in:
Derrick Hammer 2023-11-18 04:00:00 -05:00
parent 0a66d78298
commit b578a32a44
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 6 additions and 1 deletions

View File

@ -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;
} }