Socket
Socket
Sign inDemoInstall

@sentry/minimal

Package Overview
Dependencies
4
Maintainers
12
Versions
248
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @sentry/minimal

Sentry minimal library that can be used in other packages


Version published
Weekly downloads
2.6M
decreased by-0.77%
Maintainers
12
Install size
1.48 MB
Created
Weekly downloads
 

Package description

What is @sentry/minimal?

The @sentry/minimal package is a core part of the Sentry SDK for JavaScript, which is designed for error tracking and monitoring in applications. It provides a minimalistic interface to capture exceptions and messages, allowing developers to report errors to Sentry without needing the full Sentry SDK. This can be particularly useful for lightweight applications or specific use cases where the full functionality of Sentry is not required.

What are @sentry/minimal's main functionalities?

Capture exceptions

This feature allows developers to manually capture exceptions and send them to Sentry for monitoring and analysis. It's useful for catching and reporting errors that occur in try-catch blocks or in parts of the application where automatic error capturing isn't feasible.

Sentry.captureException(new Error('Something went wrong'));

Capture messages

This functionality enables the sending of custom messages to Sentry. It's useful for tracking events or states in the application that aren't necessarily errors but are significant enough to be monitored.

Sentry.captureMessage('Something important happened');

Other packages similar to @sentry/minimal

Readme

Source


Sentry JavaScript SDK Minimal

npm version npm dm npm dt typedoc

General

A minimal Sentry SDK 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. If the user is using Sentry in their application and your library uses @sentry/minimal, the user receives all breadcrumbs/messages/events you added to your libraries codebase.

Usage

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

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

// 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 interfere 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.configureScope(scope => {
  scope.setExtra('battery', 0.7);
  scope.setTag('user_mode', 'admin');
  scope.setUser({ id: '4711' });
  // scope.clear();
});

FAQs

Last updated on 26 Apr 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc