Skip to content

Commit

Permalink
wrap cache retrieval in try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottyPoi committed Feb 3, 2025
1 parent eb2cfb1 commit 15a8048
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/portalnetwork/src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,13 @@ export class PortalNetwork extends EventEmitter<PortalNetworkEvents> {
await this.discv5.start()
await this.db.open()
const storedIndex = await this.db.getBlockIndex()
const storedEnrCache = await this.db.get('enr_cache')
if (storedEnrCache) {
this.enrCache = new Map(JSON.parse(storedEnrCache))
try {
const storedEnrCache = await this.db.get('enr_cache')
if (storedEnrCache) {
this.enrCache = new Map(JSON.parse(storedEnrCache))
}
} catch {
// No action
}
for (const network of this.networks.values()) {
try {
Expand Down

0 comments on commit 15a8048

Please sign in to comment.