Skip to content
Branch: master
Find file History
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
examples chore: fix 404 error in example (#2180) Jul 29, 2019
src update link (#2223) Sep 3, 2019
test
.npmignore feat: Tracing + Reduced Bundle Size + build updates (#2038) May 8, 2019
LICENSE fix: License file to be the same as in package.json Mar 20, 2019
README.md meta: CI updates (#1950) Mar 20, 2019
package.json release: 5.6.3 Aug 29, 2019
rollup.config.js
tsconfig.build.json fix: Build for browser Mar 20, 2019
tsconfig.esm.json feat: esm build (#1779) Jan 10, 2019
tsconfig.json meta: Prepare 4.5.0 Jan 10, 2019
tslint.json style(lint): Introduce no-console rule to some pkg (#2112) Jun 7, 2019

README.md


Official Sentry SDK for Browsers

Sauce Test Status npm version npm dm npm dt typedoc

Links

Usage

To use this SDK, call Sentry.init(options) as early as possible after loading the page. This will initialize the SDK and hook into the environment. Note that you can turn off almost all side effects using the respective options.

import * as Sentry from '@sentry/browser';

Sentry.init({
  dsn: '__DSN__',
  // ...
});

To set context information or send manual events, use the exported functions of @sentry/browser. Note that these functions will not perform any action before you have called Sentry.init():

import * as Sentry from '@sentry/browser';

// Set user information, as well as tags and further extras
Sentry.configureScope(scope => {
  scope.setExtra('battery', 0.7);
  scope.setTag('user_mode', 'admin');
  scope.setUser({ id: '4711' });
  // scope.clear();
});

// Add a breadcrumb for future events
Sentry.addBreadcrumb({
  message: 'My Breadcrumb',
  // ...
});

// Capture exceptions, messages or manual events
Sentry.captureMessage('Hello, world!');
Sentry.captureException(new Error('Good bye'));
Sentry.captureEvent({
  message: 'Manual',
  stacktrace: [
    // ...
  ],
});
You can’t perform that action at this time.