@adhawk/error-tracking
v1.3.12
Published
Configure error tracking for your project
Downloads
82
Keywords
Readme
@adhawk/error-tracking
This package sets up error tracking for projects. Behinds the curtains, it sets up and uses sentry.io.
Setup
NPM
import { init as errorTrackingInit } from "@adhawk/error-tracking";
init({
release: "v1.0",
environment: "production",
sentryDsn: "...",
});
Browser
In the head
tag:
<script src="https://unpkg.com/@adhawk/error-tracking"></script>
Usage
Identifying Users
This is useful for knowing which users encountered errors.
import { identify as identifyForErrorTracking } from "@adhawk/error-tracking";
identify({
id: loggedInUser.id,
username: loggedInUser.name,
email: loggedInUser.email,
});
Manually Capturing Errors
This is useful for reporting exceptions which are caught.
import { captureException } from "@adhawk/error-tracking";
try {
throw new Error("Oh no!");
} catch (e) {
captureException(e);
}