Files
freeCodeCamp/client/src/utils/report-error.ts

16 lines
404 B
TypeScript
Raw Normal View History

import * as Sentry from '@sentry/gatsby';
import envData from '../../../config/env.json';
const { sentryClientDSN } = envData;
export function reportClientSideError(
e: Error,
message = sentryClientDSN === null
? 'Unhandled error'
: 'Error sent to Sentry'
): string | void {
return sentryClientDSN === null
? console.error(`Client: ${message}`, e)
: Sentry.captureException(e);
}