diff --git a/.changeset/bright-falcon-catch.md b/.changeset/bright-falcon-catch.md new file mode 100644 index 000000000..f5b00c65c --- /dev/null +++ b/.changeset/bright-falcon-catch.md @@ -0,0 +1,5 @@ +--- +"@exactly/mobile": patch +--- + +🥅 deduplicate and fingerprint unknown passkey sentry reports diff --git a/src/utils/server.ts b/src/utils/server.ts index c461292bf..3b0da6f39 100644 --- a/src/utils/server.ts +++ b/src/utils/server.ts @@ -61,23 +61,19 @@ queryClient.setQueryDefaults(["auth"], { return parse(Auth, expires); }, meta: { - suppressError: (error) => { - if (error instanceof ValiError) return true; - if ( - error instanceof Error && + suppressError: (error) => + error instanceof ValiError || + (error instanceof Error && (error.name === "NotAllowedError" || + error.message === "UnknownError" || error.message === "The operation couldn’t be completed. (com.apple.AuthenticationServices.AuthorizationError error 1001.)" || error.message === "The operation couldn’t be completed. (com.apple.AuthenticationServices.AuthorizationError error 1004.)" || error.message === "The operation couldn’t be completed. Device must be unlocked to perform request." || error.message === "UserCancelled" || - error.message.startsWith("androidx.credentials.exceptions.domerrors.NotAllowedError")) - ) { - return true; - } - return false; - }, + error.message.startsWith("androidx.credentials.exceptions.domerrors.NotAllowedError") || + ("code" in error && error.code === "ERR_UNKNOWN"))), }, }); diff --git a/src/utils/useAuth.ts b/src/utils/useAuth.ts index cb3228f13..4ae941972 100644 --- a/src/utils/useAuth.ts +++ b/src/utils/useAuth.ts @@ -84,5 +84,10 @@ function handleError( ) { onDomainError(); } - reportError(error); + reportError( + error, + error instanceof Error && !(error instanceof APIError) && "code" in error + ? { fingerprint: ["{{ default }}", (error as Error & { code: string }).code] } + : undefined, + ); }