Friday 26 May 2023

Comments Adapter not handling CKEditorError errors when Promise is rejected

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.

  • Should I expect the Comments feature to display the error somehow?
  • How do I know the watchdog is watching and doing its work?
  • Why adapter 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.


from Comments Adapter not handling CKEditorError errors when Promise is rejected

No comments:

Post a Comment