shrimp/src/editor/plugins/catchErrors.ts
2025-10-22 11:23:11 -07:00

10 lines
329 B
TypeScript

import { errorSignal } from '#editor/editor'
import { EditorView } from '@codemirror/view'
export const catchErrors = EditorView.exceptionSink.of((exception) => {
console.error('CodeMirror error:', exception)
errorSignal.emit(
`Editor error: ${exception instanceof Error ? exception.message : String(exception)}`
)
})