What is @bugsnag/browser?
@bugsnag/browser is a JavaScript library for capturing and reporting errors in web applications. It helps developers monitor and track errors in real-time, providing detailed reports that include stack traces, user information, and other contextual data to help diagnose and fix issues quickly.
What are @bugsnag/browser's main functionalities?
Error Reporting
This feature allows you to capture and report errors that occur in your application. By initializing the Bugsnag client with your API key, you can use the `notify` method to send error reports to Bugsnag.
const bugsnagClient = bugsnag('YOUR_API_KEY');
try {
// Code that may throw an error
} catch (e) {
bugsnagClient.notify(e);
}
Breadcrumbs
Breadcrumbs are a way to log events leading up to an error, providing context that can help diagnose the issue. This feature allows you to leave breadcrumbs that will be included in error reports.
const bugsnagClient = bugsnag('YOUR_API_KEY');
bugsnagClient.leaveBreadcrumb('User clicked on button', { buttonId: 'submit' });
User Information
This feature allows you to attach user information to error reports, making it easier to identify and address issues affecting specific users.
const bugsnagClient = bugsnag('YOUR_API_KEY');
bugsnagClient.setUser('12345', 'user@example.com', 'John Doe');
Custom Metadata
Custom metadata allows you to include additional contextual information in your error reports. This can be useful for debugging and understanding the state of your application when the error occurred.
const bugsnagClient = bugsnag('YOUR_API_KEY');
bugsnagClient.addMetadata('account', { id: '12345', name: 'Acme Co.' });
Other packages similar to @bugsnag/browser
rollbar
Rollbar is another error tracking service that offers real-time error reporting and monitoring. It provides features like error grouping, user tracking, and custom metadata, similar to @bugsnag/browser. Rollbar also offers integrations with various development tools and services.
airbrake-js
Airbrake is an error monitoring service that captures and reports errors in web applications. It offers features like error reporting, user tracking, and custom metadata, similar to @bugsnag/browser. Airbrake also provides integrations with various development and collaboration tools.
@bugsnag/browser
This package contains the browser implementation of the Bugsnag notifier for JavaScript. The normal use case is to install this package via @bugsnag/js
, but you can install it directly if you want to.
License
MIT