• Version 3.27.2
  • Published
  • 7.52 MB
  • No dependencies
  • BSD-2-Clause license


npm i raven-js
yarn add raven-js
pnpm add raven-js


JavaScript client for Sentry



variable Raven

var Raven: Raven.RavenStatic;


    interface AutoBreadcrumbOptions

    interface AutoBreadcrumbOptions {}

      property console

      console?: boolean;

        property dom

        dom?: boolean;

          property location

          location?: boolean;

            property sentry

            sentry?: boolean;

              property xhr

              xhr?: boolean;
                interface Breadcrumb {}
                  category?: string;
                    data?: any;
                      level?: LogLevel;
                        message?: string;
                          type?: BreadcrumbType;

                            interface RavenInstrumentationOptions

                            interface RavenInstrumentationOptions {}

                              property tryCatch

                              tryCatch?: boolean;

                                interface RavenOptions

                                interface RavenOptions {}

                                  property allowDuplicates

                                  allowDuplicates?: boolean;
                                  • By default, Raven.js attempts to suppress duplicate captured errors and messages that occur back-to-back. Such events are often triggered by rogue code (e.g. from a setInterval callback in a browser extension), are not actionable, and eat up your event quota.

                                  property allowSecretKey

                                  allowSecretKey?: boolean;
                                  • Allow use of private/secretKey.

                                  property autoBreadcrumbs

                                  autoBreadcrumbs?: boolean | AutoBreadcrumbOptions;
                                  • Enables/disables automatic collection of breadcrumbs.

                                  property breadcrumbCallback

                                  breadcrumbCallback?: (data: any) => any;
                                  • A function that allows filtering or mutating breadcrumb payloads. Return false to throw away the breadcrumb.

                                  property captureUnhandledRejections

                                  captureUnhandledRejections?: boolean;
                                  • By default, Raven captures all unhandled promise rejections using standard unhandledrejection event. If you want to disable this behaviour, set this option to false

                                  property dataCallback

                                  dataCallback?: (data: any) => any;
                                  • A function which allows mutation of the data payload right before being sent to Sentry

                                  property debug

                                  debug?: boolean;
                                  • If set to true, Raven.js outputs some light debugging information onto the console.

                                  property environment

                                  environment?: string;
                                  • The environment of the application you are monitoring with Sentry

                                  property extra

                                  extra?: any;

                                    property fetchParameters

                                    fetchParameters?: {
                                    [key: string]: string | Function;
                                    • fetch init parameters

                                    property fingerprint

                                    fingerprint?: string[];
                                    • In some cases you may see issues where Sentry groups multiple events together when they should be separate entities. In other cases, Sentry simply doesn’t group events together because they’re so sporadic that they never look the same.

                                    property headers

                                    headers?: {
                                    [key: string]: string | Function;
                                    • Append headers to the fetch or XMLHttpRequest request. Should be in a form of hash, were value can be string or function

                                    property ignoreErrors

                                    ignoreErrors?: (RegExp | string)[];
                                    • List of messages to be filtered out before being sent to Sentry.

                                    property ignoreUrls

                                    ignoreUrls?: (RegExp | string)[];
                                    • Similar to ignoreErrors, but will ignore errors from whole urls patching a regex pattern.

                                    property includePaths

                                    includePaths?: (RegExp | string)[];
                                    • An array of regex patterns to indicate which urls are a part of your app.

                                    property instrument

                                    instrument?: boolean | RavenInstrumentationOptions;
                                    • Enables/disables instrumentation of globals.

                                    property level

                                    level?: LogLevel;
                                    • The log level associated with this event. Default: error

                                    property logger

                                    logger?: string;
                                    • The name of the logger used by Sentry. Default: javascript

                                    property maxBreadcrumbs

                                    maxBreadcrumbs?: number;
                                    • By default, Raven captures as many as 100 breadcrumb entries. If you find this too noisy, you can reduce this number by setting maxBreadcrumbs. Note that this number cannot be set higher than the default of 100.

                                    property maxMessageLength

                                    maxMessageLength?: number;
                                    • By default, Raven does not truncate messages. If you need to truncate characters for whatever reason, you may set this to limit the length.

                                    property maxUrlLength

                                    maxUrlLength?: number;
                                    • By default, Raven will truncate URLs as they appear in breadcrumbs and other meta interfaces to 250 characters in order to minimize bytes over the wire. This does *not* affect URLs in stack traces.

                                    property release

                                    release?: string;
                                    • The release version of the application you are monitoring with Sentry

                                    property sampleRate

                                    sampleRate?: number;
                                    • A sampling rate to apply to events. A value of 0.0 will send no events, and a value of 1.0 will send all events (default).

                                    property sanitizeKeys

                                    sanitizeKeys?: (RegExp | string)[];
                                    • An array of strings representing keys that should be scrubbed from the payload sent to Sentry

                                    property serverName

                                    serverName?: string;
                                    • The name of the server or device that the client is running on

                                    property shouldSendCallback

                                    shouldSendCallback?: (data: any) => boolean;
                                    • A callback function that allows you to apply your own filters to determine if the message should be sent to Sentry.

                                    property stacktrace

                                    stacktrace?: boolean;
                                    • set to true to get the stack trace of your message

                                    property tags

                                    tags?: {
                                    [id: string]: string;
                                    • Additional data to be tagged onto the error.

                                    property transport

                                    transport?: (options: RavenTransportOptions) => void;
                                    • Override the default HTTP data transport handler.

                                    property whitelistUrls

                                    whitelistUrls?: (RegExp | string)[];
                                    • The inverse of ignoreUrls. Only report errors from whole urls matching a regex pattern.

                                    interface RavenPlugin

                                    interface RavenPlugin {}

                                      call signature

                                      (raven: RavenStatic, ...args: any[]): RavenStatic;

                                        interface RavenStatic

                                        interface RavenStatic {}

                                          property Plugins

                                          Plugins: { [id: string]: RavenPlugin };

                                            property VERSION

                                            VERSION: string;
                                            • Raven.js version.

                                            method addPlugin

                                            addPlugin: (plugin: RavenPlugin, ...pluginArgs: any[]) => RavenStatic;
                                            • Adds a plugin to Raven


                                            method afterLoad

                                            afterLoad: () => void;
                                            • Allow Raven to be configured as soon as it is loaded It uses a global RavenConfig = {dsn: '...', config: {}}


                                            method captureBreadcrumb

                                            captureBreadcrumb: (crumb: Breadcrumb) => RavenStatic;
                                            • Log a breadcrumb

                                            method captureException

                                            captureException: (ex: unknown, options?: RavenOptions) => RavenStatic;
                                            • Manually capture an exception and send it over to Sentry

                                              Parameter ex

                                              An exception to be logged

                                              Parameter options

                                              A specific set of options for this error [optional] {Raven}

                                            method captureMessage

                                            captureMessage: (msg: string, options?: RavenOptions) => RavenStatic;
                                            • Manually send a message to Sentry

                                              Parameter msg

                                              A plain message to be captured in Sentry

                                              Parameter options

                                              A specific set of options for this message [optional] {Raven}

                                            method clearContext

                                            clearContext: () => RavenStatic;
                                            • Clear all of the context.

                                            method config

                                            config: (dsn: string, options?: RavenOptions) => RavenStatic;
                                            • Configure Raven with a DSN and extra options

                                              Parameter dsn

                                              The public Sentry DSN

                                              Parameter options

                                              Optional set of global options [optional] {Raven}

                                            method context

                                            context: {
                                            (func: Function, ...args: any[]): void;
                                            (options: RavenOptions, func: Function, ...args: any[]): void;
                                            • Wrap code within a context so Raven can capture errors reliably across domains that is executed immediately.

                                              Parameter options

                                              A specific set of options for this context [optional]

                                              Parameter func

                                              The callback to be immediately executed within the context

                                              Parameter args

                                              An array of arguments to be called with the callback [optional]

                                            method getContext

                                            getContext: () => Object;
                                            • Get a copy of the current context. This cannot be mutated.

                                            method install

                                            install: () => RavenStatic;
                                            • Installs a global window.onerror error handler to capture and report uncaught exceptions. At this point, install() is required to be called due to the way TraceKit is set up.


                                            method isSetup

                                            isSetup: () => boolean;
                                            • If you need to conditionally check if raven needs to be initialized or not, you can use the isSetup function. It will return true if Raven is already initialized.

                                            method lastEventId

                                            lastEventId: () => string;
                                            • An event id is a globally unique id for the event that was just sent. This event id can be used to find the exact event from within Sentry.

                                            method lastException

                                            lastException: () => Error;
                                            • Get the latest raw exception that was captured by Raven.

                                            method noConflict

                                            noConflict: () => RavenStatic;
                                            • Allow multiple versions of Raven to be installed. Strip Raven from the global context and returns the instance.


                                            method setBreadcrumbCallback

                                            setBreadcrumbCallback: (callback?: RavenCallback) => RavenStatic;
                                            • Specify a callback function that allows you to mutate or filter breadcrumbs when they are captured.

                                            method setDataCallback

                                            setDataCallback: (callback?: RavenCallback) => RavenStatic;
                                            • Specify a function that allows mutation of the data payload right before being sent to Sentry.

                                            method setDSN

                                            setDSN: (dsn: string) => void;
                                            • Configure Raven DSN

                                              Parameter dsn

                                              The public Sentry DSN

                                            method setEnvironment

                                            setEnvironment: (environment: string) => RavenStatic;
                                            • Set environment of application

                                            method setExtraContext

                                            setExtraContext: (context?: Object) => RavenStatic;
                                            • Merge extra attributes to be sent along with the payload.

                                              Parameter context

                                              A set of data to be merged with the current extra context data [optional] If context is undefined, the current extra context data will be removed. {Raven}

                                            method setRelease

                                            setRelease: (release: string) => RavenStatic;
                                            • Set release version of application

                                            method setShouldSendCallback

                                            setShouldSendCallback: (callback?: RavenCallback) => RavenStatic;
                                            • Specify a callback function that allows you to apply your own filters to determine if the message should be sent to Sentry.

                                            method setTagsContext

                                            setTagsContext: (tags?: Object) => RavenStatic;
                                            • Merge tags to be sent along with the payload.

                                              Parameter tags

                                              A set of data to be merged with the current tag context data [optional] If tags is undefined, the current tag context data will be removed. {Raven}

                                            method setTransport

                                            setTransport: (
                                            transportFunction: (options: RavenTransportOptions) => void
                                            ) => RavenStatic;
                                            • Override the default HTTP data transport handler.

                                            method setUserContext

                                            setUserContext: (user?: { [key: string]: any }) => RavenStatic;
                                            • Set/Clear a user to be sent along with the payload.

                                              Parameter user

                                              An object representing user data [optional] If user is undefined, the current user context will be removed. {Raven}

                                            method showReportDialog

                                            showReportDialog: (options?: Object) => void;
                                            • Show Sentry user feedback dialog

                                            method uninstall

                                            uninstall: () => RavenStatic;
                                            • Uninstalls the global error handler.


                                            method wrap

                                            wrap: {
                                            (func: Function): Function;
                                            (options: RavenOptions, func: Function): Function;
                                            <T extends Function>(func: T): T;
                                            <T extends Function>(options: RavenOptions, func: T): T;
                                            • Wrap code within a context and returns back a new function to be executed

                                              Parameter options

                                              A specific set of options for this context [optional]

                                              Parameter func

                                              The function to be wrapped in a new context {function} The newly wrapped functions with a context

                                            interface RavenTransportOptions

                                            interface RavenTransportOptions {}

                                              property auth

                                              auth: {
                                              sentry_version: string;
                                              sentry_client: string;
                                              sentry_key: string;

                                                property data

                                                data: any;

                                                  property url

                                                  url: string;

                                                    method onError

                                                    onError: (error: Error & { request?: XMLHttpRequest }) => void;

                                                      method onSuccess

                                                      onSuccess: () => void;

                                                        Type Aliases

                                                        type BreadcrumbType = 'navigation' | 'http';

                                                          type LogLevel

                                                          type LogLevel =
                                                          | 'critical'
                                                          | 'fatal'
                                                          | 'error'
                                                          | 'warning'
                                                          | 'info'
                                                          | 'debug'
                                                          | 'warn'
                                                          | 'log';
                                                          • Event/Breadcrumb Severity. critical is for Breadcrumbs only and fatal is for Events only.

                                                          type RavenCallback

                                                          type RavenCallback = (data: any, orig?: (data: any) => any) => any | void;

                                                            Package Files (1)

                                                            Dependencies (0)

                                                            No dependencies.

                                                            Dev Dependencies (37)

                                                            Peer Dependencies (0)

                                                            No peer dependencies.


                                                            To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                            You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/raven-js.

                                                            • Markdown
                                                            • HTML
                                                              <a href="https://www.jsdocs.io/package/raven-js"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>