From a824717b5f602952c8ef8e1a8744980b0b6af4b4 Mon Sep 17 00:00:00 2001 From: Marcos Date: Sat, 15 Aug 2026 20:45:14 +0200 Subject: [PATCH] Return error response for missing or invalid note title and body in sync process --- src/services/syncService.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/syncService.js b/src/services/syncService.js index 684c2ca..3dc326b 100644 --- a/src/services/syncService.js +++ b/src/services/syncService.js @@ -117,8 +117,8 @@ class SyncService { for (const incomingNote of incomingNotes) { const permanentDelete = Boolean(incomingNote.permanentDelete); - if (!incomingNote.id || (!permanentDelete && (!incomingNote.title || !incomingNote.body))) { - throw new Error('Cada nota debe incluir id, title y body'); + if (!incomingNote.id || typeof incomingNote.title !== 'string' || typeof incomingNote.body !== 'string') { + return res.status(400).json({ message: "Cada nota debe incluir id, title y body" }); } const incomingBaseVersion = getIncomingVersion('nota', incomingNote);