exception-logger.ts 510 B

123456789101112131415
  1. import { Extension } from '@codemirror/state'
  2. import { EditorView } from '@codemirror/view'
  3. import { captureException } from '../../../infrastructure/error-reporter'
  4. /**
  5. * A custom extension which configures the EditorView.exceptionSink facet
  6. * so that exceptions are sent to Sentry with a `cm6-exception` tag.
  7. */
  8. export const exceptionLogger = (): Extension => {
  9. return EditorView.exceptionSink.of(exception => {
  10. captureException(exception, {
  11. tags: { handler: 'cm6-exception' },
  12. })
  13. })
  14. }