mirror of
https://github.com/cudr/slate-collaborative.git
synced 2024-10-27 20:34:06 +00:00
fix: add error handling for applyOperation
This commit is contained in:
parent
baeab8a74c
commit
025943de4e
@ -138,7 +138,12 @@ export const AutomergeEditor = {
|
|||||||
Promise.resolve().then(_ => (e.isRemote = false))
|
Promise.resolve().then(_ => (e.isRemote = false))
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
// unset remove flag
|
||||||
|
if (e.isRemote) {
|
||||||
|
e.isRemote = false
|
||||||
|
}
|
||||||
|
|
||||||
|
throw e
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -108,7 +108,12 @@ const withAutomerge = <T extends Editor>(
|
|||||||
e.receiveOperation = data => {
|
e.receiveOperation = data => {
|
||||||
if (docId !== data.docId) return
|
if (docId !== data.docId) return
|
||||||
|
|
||||||
|
try {
|
||||||
AutomergeEditor.applyOperation(e, docId, data, preserveExternalHistory)
|
AutomergeEditor.applyOperation(e, docId, data, preserveExternalHistory)
|
||||||
|
} catch (err) {
|
||||||
|
// report any errors during apply operation
|
||||||
|
onError(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return e
|
return e
|
||||||
|
Loading…
Reference in New Issue
Block a user