ソースを参照

Improved error docs.

Maciej Bukowski 5 年 前
コミット
63ae848d04

+ 6 - 2
packages/ckeditor5-watchdog/docs/features/watchdog.md

@@ -257,11 +257,15 @@ const contextState = watchdog.state;
 
 // The `error` event is fired when the context watchdog catches the context-related error.
 // Note that the item errors are not re-fired in the `ContextWatchdog#error`.
-watchdog.on( 'error', ( evt, { error } ) => {} );
+watchdog.on( 'error', ( evt, { error } ) => {
+	console.log( 'The context crashed.' );
+} );
 
 // The `restarted` event is fired when the context is set back to the `ready` state (after it was in `error` state).
 // Similarly, this event is not thrown for internal item restarts.
-watchdog.on( 'restart', () => {} );
+watchdog.on( 'restart', () => {
+	console.log( 'The context has been restarted.' );
+} );
 
 // The `itemError` event is fired when an error occurred in one of the added items
 watchdog.on( 'itemError', ( evt, { error, itemId } ) => {

+ 2 - 2
packages/ckeditor5-watchdog/src/contextwatchdog.js

@@ -456,7 +456,7 @@ export default class ContextWatchdog extends Watchdog {
 	 * Fired when a new error occurred in one of the added items.
 	 *
 	 * 	watchdog.on( 'itemError', ( evt, { error, itemId, causesRestart } ) => {
-	 *		console.log( `An error occurred in the item with the '${ itemId }' id.` );
+	 *		console.log( `An error occurred in an item with the '${ itemId }' id.` );
 	 * 	} );
 	 *
 	 * @event itemError
@@ -466,7 +466,7 @@ export default class ContextWatchdog extends Watchdog {
 	 * Fired after an item has been restarted.
 	 *
 	 * 	watchdog.on( 'itemRestart', ( evt, { itemId } ) => {
-	 *		console.log( 'The item with with the '${ itemId }' id has been restarted.' );
+	 *		console.log( 'An item with with the '${ itemId }' id has been restarted.' );
 	 * 	} );
 	 *
 	 * @event itemRestart