-
Notifications
You must be signed in to change notification settings - Fork 104
Description
onError
callback not triggered in some initialization failure scenarios
Summary
The onError
callback is not consistently invoked in certain failure cases during the _initializeEditor
method in the CKEditor5
React component.
Details
There are two observed scenarios where onError
is not called, even though an error is thrown internally and logged via the semaphore mechanism:
-
When
disableWatchdog=true
:
If the editor initialization fails and the watchdog is explicitly disabled, theonError
callback is not triggered. The error is logged, but the consuming application cannot react to the failure via the provided hook. -
When the watchdog is enabled but fails to initialize the editor even once:
In rare cases, the watchdog cannot initialize the editor successfully at all (e.g., due to configuration errors or external dependencies). In such cases,onError
is also not triggered.
This inconsistent behavior can lead to silent failures in production, where applications relying on onError
for error reporting, user notifications, or retries are left unaware of the problem.
Expected Behavior
The onError
callback should be reliably called in any scenario where editor initialization fails, regardless of whether the watchdog is enabled or not.
Steps to Reproduce
- Set
disableWatchdog: true
- Provide an invalid editor configuration that causes the editor to fail during
_initializeEditor
- Observe that
onError
is not called, despite the failure being logged internally.
Possible Fix
Wrap all async calls inside the _initializeEditor
method with appropriate try/catch
blocks and explicitly invoke onError
in the catch
clauses. This includes, but is not limited to, the logic between lines 226–296 of ckeditor.tsx
. Both watchdog-enabled and watchdog-disabled branches should propagate initialization errors via the onError
callback.