2022-04-15 10:54:02 -04:00
|
|
|
import * as Sentry from '@sentry/gatsby';
|
|
|
|
import envData from '../../../config/env.json';
|
|
|
|
|
|
|
|
const { sentryClientDSN } = envData;
|
|
|
|
|
2021-07-12 02:17:58 -07:00
|
|
|
export function reportClientSideError(
|
|
|
|
e: Error,
|
2022-04-15 10:54:02 -04:00
|
|
|
message = sentryClientDSN === null
|
|
|
|
? 'Unhandled error'
|
|
|
|
: 'Error sent to Sentry'
|
|
|
|
): string | void {
|
|
|
|
return sentryClientDSN === null
|
|
|
|
? console.error(`Client: ${message}`, e)
|
|
|
|
: Sentry.captureException(e);
|
2021-07-12 02:17:58 -07:00
|
|
|
}
|