diff --git a/packages/discovery/src/local-peer-cache/index.ts b/packages/discovery/src/local-peer-cache/index.ts index b6d4efc13c..14a79013e7 100644 --- a/packages/discovery/src/local-peer-cache/index.ts +++ b/packages/discovery/src/local-peer-cache/index.ts @@ -136,7 +136,11 @@ export class LocalPeerCacheDiscovery } private savePeersToLocalStorage(): void { - localStorage.setItem("waku:peers", JSON.stringify(this.peers)); + try { + localStorage.setItem("waku:peers", JSON.stringify(this.peers)); + } catch (error) { + log.error("Error saving peers to local storage:", error); + } } }