Skip to content

Commit

Permalink
Send exceptions raised in update listeners to the exception sink
Browse files Browse the repository at this point in the history
FIX: Exceptions raised by update listeners are now routed to the configured exception
sink, if any.

Closes codemirror/dev#1287
  • Loading branch information
marijnh committed Oct 26, 2023
1 parent e6a55a6 commit 5dfda8e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/editorview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,10 @@ export class EditorView {
this.viewState.mustMeasureContent = true
if (redrawn || attrsChanged || scrollTarget || this.viewState.mustEnforceCursorAssoc || this.viewState.mustMeasureContent)
this.requestMeasure()
if (!update.empty) for (let listener of this.state.facet(updateListener)) listener(update)
if (!update.empty) for (let listener of this.state.facet(updateListener)) {
try { listener(update) }
catch (e) { logException(this.state, e, "update listener") }
}

if (dispatchFocus || domChange) Promise.resolve().then(() => {
if (dispatchFocus && this.state == dispatchFocus.startState) this.dispatch(dispatchFocus)
Expand Down

0 comments on commit 5dfda8e

Please sign in to comment.