Error reporting

Important: start the server with CK_DEBUG=false pnpm manual. With CK_DEBUG on — which is the default — every // @if CK_DEBUG // throw err; line becomes live code, which skips the wrapping in CKEditorError.rethrowUnexpectedError(). A plain error then stays a plain error on its way out, and the last case below behaves differently.

One onEditorError() callback is registered for the whole page. Every reported error is appended to the log at the bottom, together with the editor it was attributed to. Keep the browser console open — reporting does not swallow anything, so every error should appear there as well.

  1. Click Throw from a plugin under the first editor. Two entries should appear in the log, one naming editor 1 and one naming editor 3 — see the note below. The error should also be in the console, once.
  2. Do the same under the second editor. One entry, naming editor 2. Both editors should still work — nothing restarts, so the content stays exactly as it was.
  3. Type something in both editors, then throw again. The content must not change and undo must still reach what you typed, because the editor is never rebuilt.
  4. Click Throw with no attribution. The error is thrown with null as its context, so nothing should appear in the log — but it must still be visible in the console. This is what "reporting only, nothing swallowed" means.
  5. Click Throw a plain error. It is not a CKEditorError, so nothing should appear in the log, and the console shows it as usual.
  6. Click Throw from a plugin under the third editor. Again two entries, naming editor 1 and editor 3. When this names editor 3 alone, attribution no longer searches object graphs and this case can go.

Why editors 1 and 3 are both reported. Which editor an error belongs to is currently decided by walking both object graphs and looking for anything they have in common, and every editor that matches is reported, the way the Watchdog restarted every editor connected to the error.

Editors 1 and 3 both load the list feature. ListEditing passes one and the same module-level array to the schema of every editor that loads it (LIST_BASE_ATTRIBUTES), so those two have an object in common and an error from either of them matches both. It takes two editors to show this: a feature loaded by a single editor shares nothing with anyone. Editor 2 does not load lists, which is why it is named alone.

Editor 1 — loads the list feature

The first editor.

Editor 2 — does not load the list feature

The second editor.

Editor 3 — loads the list feature, like editor 1

The third editor.

Errors that must not be reported

Reported errors