0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 14:12:40 +00:00

Additional diff server error logging

This commit is contained in:
Trevor Buckner
2025-07-10 00:37:03 -04:00
parent 0e1ac26999
commit 7ba7991631

View File

@@ -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;