From e5540f84729a395453093ef480137dbd5dc3b54d Mon Sep 17 00:00:00 2001 From: Jakob Niggel Date: Fri, 4 Oct 2024 13:57:20 +0200 Subject: [PATCH] fix: better cache handling --- lib/config.mjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/config.mjs b/lib/config.mjs index 2170557..da846fa 100644 --- a/lib/config.mjs +++ b/lib/config.mjs @@ -133,7 +133,12 @@ export async function readCache(sessionName) { } catch (_) { return {}; } - return JSON.parse(await readFile(cacheFile, "utf8")); + + try { + JSON.parse(await readFile(cacheFile, "utf8")); + } catch (_) { + return {}; + } } export async function readAccountCache(sessionName) {