mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-27 20:01:56 -04:00
* refactor: explicit types for validate * refactor: explicit return types for ui-components * refactor: use exec instead of match * refactor: add lots more boundary types * refactor: more eslint warnings * refactor: more explicit exports * refactor: more explicit types * refactor: even more explicit types * fix: relax type contrainsts for superblock-order * refactor: final boundaries * refactor: avoid using 'object' type * fix: use named import for captureException This uses TypeScript (which works) instead of import/namespace (which doesn't) to check if captureException exists in sentry/gatsby (it does)
16 lines
406 B
TypeScript
16 lines
406 B
TypeScript
import { captureException } 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)
|
|
: captureException(e);
|
|
}
|