From f5f23d85e08c52a96bc2309cf3864641f7c117ea Mon Sep 17 00:00:00 2001 From: Ryan Mwangi Date: Mon, 21 Oct 2024 15:33:57 +0300 Subject: [PATCH] edit server side code error message for wrong user input --- server.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 7511f01..c4d2705 100644 --- a/server.js +++ b/server.js @@ -30,8 +30,8 @@ app.post('/merge', async (req, res) => { try { // Validate the input - if (!linkGroupName || !calendars || !Array.isArray(calendars)) { - return res.status(400).json({ error: 'Invalid input' }); + if (!linkGroupName || !calendars || !Array.isArray(calendars) || calendars.length === 0) { + return res.status(400).json({ error: 'Invalid input. Please provide a linkGroupName and at least one calendar.' }); } // Generate a unique identifier for this set of calendars const calendarId = crypto.randomBytes(16).toString('hex');