From 7ba7991631a01a8b2c8ca84f61f513f2100347e5 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Thu, 10 Jul 2025 00:37:03 -0400 Subject: [PATCH] Additional diff server error logging --- server/homebrew.api.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/server/homebrew.api.js b/server/homebrew.api.js index bb0ab5e75..84f639a4d 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -357,7 +357,17 @@ const api = { let brew = _.assign(brewFromServer, brewFromClient); brew.title = brew.title.trim(); brew.description = brew.description.trim() || ''; - brew.text = applyPatches(parsePatch(brewFromClient.patches), brewFromServer.text)[0]; + try { + const patches = parsePatch(brewFromClient.patches); + brew.text = applyPatches(patches, brewFromServer.text)[0]; + } catch (err) { + console.error('Failed to apply patches:', { + patches: brewFromClient.patches, + brewId: brew.editId || 'unknown' + }); + throw err; // rethrow to preserve the 500 behavior + } + brew.text = api.mergeBrewText(brew); const googleId = brew.googleId;