fix: add error handling for applyOperation

This commit is contained in:
Eric Maciel 2020-10-30 15:27:26 -04:00
parent baeab8a74c
commit 025943de4e
2 changed files with 12 additions and 2 deletions

View File

@ -138,7 +138,12 @@ export const AutomergeEditor = {
Promise.resolve().then(_ => (e.isRemote = false))
}
} catch (e) {
console.error(e)
// unset remove flag
if (e.isRemote) {
e.isRemote = false
}
throw e
}
},

View File

@ -108,7 +108,12 @@ const withAutomerge = <T extends Editor>(
e.receiveOperation = data => {
if (docId !== data.docId) return
AutomergeEditor.applyOperation(e, docId, data, preserveExternalHistory)
try {
AutomergeEditor.applyOperation(e, docId, data, preserveExternalHistory)
} catch (err) {
// report any errors during apply operation
onError(err)
}
}
return e