core/errorreporter
module
Interfaces
module:core/errorreporter~EditorErrorData
Type Definitions
module:core/errorreporter~EditorErrorCallback
Functions
onEditorError( callback ) → () => voidmodule:core/errorreporter~onEditorErrorRegisters a callback for errors that escape an editor, and returns a function that unregisters it.
Copy codeconst off = onEditorError( ( { error, source } ) => { if ( source !== myEditor ) { return; } reportToMyErrorTracker( error ); } );There is one registration surface for the whole page rather than one per editor, so an integrator running several editors compares
sourcewith their own instance, as above. Registering the same callback twice gives two independent registrations, and each unregisters on its own.One error can reach the callback more than once, once for every editor it is attributed to — see
source.Reporting only. Nothing is restarted and nothing is swallowed — the error still reaches the console.
Parameters
callback: EditorErrorCallback
Returns
() => void