How to report console.error with Sentry?

As user @kumar303 mentioned in his comment to the question … you can use the JS console integration Sentry.Integrations.CaptureConsole.

See https://docs.sentry.io/platforms/javascript/configuration/integrations/plugin/#captureconsole for documentation.

At the end you JS code to setup Sentry looks as follows:

import * as Sentry from '@sentry/browser';
import { CaptureConsole } from '@sentry/integrations';

Sentry.init({
  dsn: 'https://your-sentry-server-dsn',
  integrations: [
    new CaptureConsole({
      levels: ['error']
    })
  ],
  release: '1.0.0',
  environment: 'prod',
  maxBreadcrumbs: 50
})

If then someone calls console.error a new event will sent to sentry.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)