Socket
Socket
Sign inDemoInstall

@sentry/shim

Package Overview
Dependencies
Maintainers
9
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sentry/shim

Sentry shim which can be used in libraries


Version published
Weekly downloads
10
increased by100%
Maintainers
9
Weekly downloads
 
Created
Source


Sentry JavaScript SDK Shim

npm version npm dm npm dt

A lightweight Sentry SDK shim that uses a configured client when embedded into an application. It allows library authors add support for a Sentry SDK without having to bundle the entire SDK or being dependent on a specific platform.

Usage

To use the shim, you do not have to initialize an SDK. This should be handled by the user of your library. Instead, direcly use the exported functions of @sentry/shim to add breadcrumbs or capture events:

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

// 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: [
    // ...
  ],
});

Note that while strictly possible, it is discouraged to interfer with the event context. If for some reason your library needs to inject context information, beware that this might override the user's context values:

// Set user information, as well as tags and further extras
Sentry.setExtraContext({ battery: 0.7 });
Sentry.setTagsContext({ user_mode: 'admin' });
Sentry.setUserContext({ id: '4711' });

FAQs

Package last updated on 03 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc