From e5e8cd5e170defc1c50ec785568b92764e904dd5 Mon Sep 17 00:00:00 2001 From: Guru <19eucs071@skcet.ac.in> Date: Fri, 12 Apr 2024 20:34:48 +0530 Subject: [PATCH] fix: add try catch to local store (#1956) --- packages/discovery/src/local-peer-cache/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); + } } }