From b865bdaf9d519e98f50a03a30f771dec59dea767 Mon Sep 17 00:00:00 2001 From: Amir Hossein Hashemi <87268103+amirhhashemi@users.noreply.github.com> Date: Sun, 25 Feb 2024 19:12:02 +0330 Subject: [PATCH] fix: add parentheses to catch --- src/vanilla/utils/atomWithStorage.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vanilla/utils/atomWithStorage.ts b/src/vanilla/utils/atomWithStorage.ts index 5e5c3bac0d..dc555e9bd9 100644 --- a/src/vanilla/utils/atomWithStorage.ts +++ b/src/vanilla/utils/atomWithStorage.ts @@ -121,7 +121,7 @@ export function createJSONStorage( if (lastStr !== str) { try { lastValue = JSON.parse(str, options?.reviver) - } catch { + } catch (_e) { return initialValue } lastStr = str @@ -155,7 +155,7 @@ export function createJSONStorage( let newValue: Value try { newValue = JSON.parse(e.newValue || '') - } catch { + } catch (_e) { newValue = initialValue } callback(newValue)