Sentry integration for tracking promises with unhandled rejections.
It uses Sentry breadcrumbs to display information about the origin of the promise that has been rejected.
PromiseTracing support both NodeJS and browser environment and relies on unhandledRejection and unhandledrejection
events respectively.
An example of integration usage could look like this:
import * as Integrations from '@sentry/integrations/esm';
import * as Sentry from '@sentry/vue';
import { withPromiseTracing } from 'sentry-promise-tracing';
import Vue from 'vue';
export function sentryInit(dsn?: string, environment?: string, release?: string): void {
if (dsn) {
Sentry.init({
dsn,
environment,
release,
Vue: Vue,
integrations: withPromiseTracing(
[],
[
new Integrations.Vue({
Vue,
attachProps: true,
}),
new Integrations.ExtraErrorData(),
new Integrations.Dedupe(),
]
),
});
}
}withPromiseTracing() accepts two lists of additional integrations, headIntegrations and tailIntegrations, that
are wrapping around default integrations,
that are passed to the integration configuration function.
This function registers PromiseTracing integration first to override the default integration for
OnUnhandledRejection.
The resulting breadcrumb will look like this:
