Skip to content

Commit

Permalink
Cause the error instead of throwing it directly.
Browse files Browse the repository at this point in the history
  • Loading branch information
scofalik committed Oct 9, 2023
1 parent 5b2c9fc commit 3b23945
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Component, ViewChild } from '@angular/core';
import { CKEditorComponent } from 'src/ckeditor';
import AngularEditor from 'ckeditor/build/ckeditor';
import type { ContextWatchdog } from '@ckeditor/ckeditor5-watchdog';
import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';

@Component( {
selector: 'app-initialization-crash',
Expand Down Expand Up @@ -32,8 +31,11 @@ export class InitializationCrashComponent {
extraPlugins: [
function( editor: any ) {
editor.data.on( 'init', () => {
// eslint-disable-next-line
throw new CKEditorError( 'example-error', editor );
// Simulate an error.
// Create a non-existing position, then try to get its parent.
const position = editor.model.createPositionFromPath( editor.model.document.getRoot(), [ 1, 2, 3 ] );

return position.parent;
} );
}
],
Expand Down

0 comments on commit 3b23945

Please sign in to comment.