From e5202791ac6f35a610055202f0f54419d9850c86 Mon Sep 17 00:00:00 2001 From: Ryan Mwangi Date: Sun, 20 Oct 2024 01:29:38 +0300 Subject: [PATCH] catch error while trying to write to calendars file --- server.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 76ba87f..ec76bdf 100644 --- a/server.js +++ b/server.js @@ -136,8 +136,12 @@ function saveCalendarData(calendarId, linkGroupName, calendars) { linkGroupName: linkGroupName, calendars: calendars }); - - fs.writeFileSync(CALENDARS_FILE, JSON.stringify(calendarsData, null, 2)); + + try { + fs.writeFileSync(CALENDARS_FILE, JSON.stringify(calendarsData, null, 2)); + } catch (error) { + console.error('Error writing to calendars file:', error); + } } // Function to update the merged calendar