https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html
Are these error codes integrated on the editor or should I handle them manually? if I add a comment using CommentAdapter
and server throws an error, would the ckeditor UI display the error if I send the promise as rejected?
It throws a CKEditorError
:
bundle.js:48916 Uncaught (in promise) CKEditorError: commentsrepository-add-comment-internal-error
Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-commentsrepository-add-comment-internal-error
at bundle.js:48916:41
but not really sure whether it has to be handled manually or UI would be responsive to this event, in the docs or samples are not demonstrations of this feature.
anyways after the CKEditorError
is thrown, watchdog
seems to be doing something but not really clear because the Editor Comments feature crashes and it is not restarted.
This is the React-CKEditor declaration:
<CKEditorContext context={ClassicEditor.Context}>
<CKEditor
editor={ClassicEditor}
onReady={async editor => {
console.log(
'onReady is called after CKEditorError',
editor,
);
... // no watchdogConfig
...
...
according to the docs the watchdog comes already on:
The React integration comes with the watchdog feature already integrated into the core.
addComment
return Promise.reject()
is crashing the entire comments functionality? According to the error it looks like I am missing something to handle, but it is not clear where.This is what CK support responded:
Our team looked at the code that you provided and again at your questions. Regarding the watchdog, please, be advised the watchdog should restart the editor when there's a crash and this is not what you want to achieve. Unfortunately, at this time, there's no default error handling for the editor. When there's a problem and the promise is rejected, the editor crashes. It will be up to you to write the logic in these places: [code snippets] The comment feature expects that the adapter call will be resolved successfully. If not, the feature only throws the returned error. Any additional logic will have to be prepared on your side. For example, if getCommentThread() fails because the thread does not exist anymore you should remove the marker, if it fails due to a connection error, you may try to make the call again after some time; if addCommentThread() fails, you may want to try again after some time or remove the marker and the data as well. We also do not provide a UI system for notifications. Since this usually depends on the application/integration, we leave it to the integrator as well. Unfortunately, this is a non-trivial amount of work. You may instead consider using the load & save integration type. This way the comment threads state will be kept locally only and you will save the comments threads data together with the document HTML.