Skip to content

Commit 4868ef9

Browse files
committed
🥅 app: align user cancellations to native behavior
1 parent 37b526c commit 4868ef9

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

‎src/utils/accountClient.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ import e2e from "./e2e";
6969
import { login } from "./onesignal";
7070
import publicClient from "./publicClient";
7171
import queryClient, { type AuthMethod } from "./queryClient";
72-
import reportError from "./reportError";
72+
import reportError, { classifyError } from "./reportError";
7373
import ownerConfig from "./wagmi/owner";
7474

7575
import type { Credential } from "@exactly/common/validation";
@@ -191,6 +191,7 @@ export default async function createAccountClient({ credentialId, factory, x, y
191191
},
192192
});
193193
} catch (error) {
194+
if (classifyError(error).authKnown) throw error;
194195
reportError(error, {
195196
level: "warning",
196197
extra: error instanceof Error ? { cause: error.cause } : undefined,
@@ -250,8 +251,8 @@ export default async function createAccountClient({ credentialId, factory, x, y
250251
});
251252
return id;
252253
} catch (error) {
254+
if (classifyError(error).authKnown) throw error;
253255
reportError(error, { level: "warning" });
254-
// TODO filter errors
255256
return client.request({ method: method as never, params: params as never });
256257
}
257258
}

‎src/utils/reportError.ts‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,18 @@ function classify({ code, message, name, reason, revert, status }: ParsedError)
115115
authPrefixes.some((prefix) => message.startsWith(prefix)));
116116
const passkeyWarning = passkeyKnown && !passkeyCancelled && !passkeyNotAllowed;
117117
const biometric = code === "ERR_BIOMETRIC";
118-
const authKnown = passkeyKnown || passkeyNotAllowed || biometric || message === "invalid operation";
118+
const walletRejected = status === "4001" || status === "5000";
119+
const bundleCancelled = status === "5730";
120+
const authKnown =
121+
passkeyKnown ||
122+
passkeyNotAllowed ||
123+
biometric ||
124+
walletRejected ||
125+
bundleCancelled ||
126+
message === "invalid operation";
119127
const network = classifyNetwork(message);
120-
const knownWarning = passkeyKnown || biometric || message === "invalid operation";
128+
const knownWarning =
129+
passkeyKnown || biometric || walletRejected || bundleCancelled || message === "invalid operation";
121130
const knownInfo = network !== undefined;
122131
const known = knownWarning || knownInfo;
123132
const value =

0 commit comments

Comments
 (0)