nexstream-api / backend /src /instrument.ts
circleci
deploy 5f9a025
51517b2
Raw
History Blame Contribute Delete
478 Bytes
import * as Sentry from '@sentry/node'; // skipcq: JS-C1003
Sentry.init({
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 0.1,
sendDefaultPii: false,
});
process.on('uncaughtException', async (error) => {
console.error('[Uncaught Exception]', error);
Sentry.captureException(error);
await Sentry.close(2000);
throw error;
});
process.on('unhandledRejection', (reason) => {
console.error('[Unhandled Rejection]', reason);
Sentry.captureException(reason);
});