Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

chore: sentry logging for domain format issues [SGW-4562] #790

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/components/Login/LoginContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@ export const InitialisationContainer: FunctionComponent<
if (queryEndpoint && queryKey) {
if (!RegExp(DOMAIN_FORMAT).test(queryEndpoint)) {
const error = new Error(`Invalid endpoint: ${queryEndpoint}`);
Sentry.captureMessage("ERROR_WITH_DOMAIN_FORMAT", {
level: "error",
extra: {
domainFormat: DOMAIN_FORMAT,
queryEndpoint,
},
});
Sentry.captureException(error);
showErrorAlert(error);
setLoginStage("SCAN");
Expand Down
6 changes: 5 additions & 1 deletion src/utils/errorTracking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const SENTRY_LOG_PREFIX = "[dev-sentry]";
let Sentry: Pick<typeof SentryExpo, "init"> &
Pick<
typeof SentryExpo.Native,
"setRelease" | "addBreadcrumb" | "captureException"
"setRelease" | "addBreadcrumb" | "captureException" | "captureMessage"
>;
if (__DEV__) {
Sentry = {
Expand All @@ -21,6 +21,10 @@ if (__DEV__) {
console.warn(`${SENTRY_LOG_PREFIX} captureException: ${e}`);
return "eventId";
},
captureMessage: (e: unknown): string => {
console.warn(`${SENTRY_LOG_PREFIX} captureMessage: ${e}`);
return "eventId";
},
};
} else {
Sentry = {
Expand Down
Loading