Skip to content

Commit 7a9a22a

Browse files
committed
feat(clerk-js): improve error handling localization for Solana signature generation
Signed-off-by: Kenton Duprey <kenton@clerk.dev>
1 parent 98508a1 commit 7a9a22a

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

packages/clerk-js/src/ui/elements/Web3WalletButtons.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,8 @@ const Web3WalletButtonsInner = ({ web3AuthCallback }: Web3WalletButtonsProps) =>
5858
card.setLoading(walletName);
5959
try {
6060
await web3AuthCallback({ walletName });
61-
} catch (error) {
61+
} catch {
6262
await sleep(1000);
63-
card.setError(error);
64-
} finally {
65-
await sleep(5000);
6663
card.setIdle();
6764
}
6865
};

packages/clerk-js/src/utils/web3.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export const generateWeb3Signature: GenerateSignature = async (params): Promise<
7171
});
7272
}
7373
throw new ClerkRuntimeError('An error occurred while generating the Solana signature.', {
74-
code: 'web3_solana_signature_error',
74+
code: 'web3_solana_signature_generation_failed',
7575
cause: err,
7676
});
7777
}

packages/localizations/src/en-US.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,9 @@ export const enUS: LocalizationResource = {
934934
phone_number_exists: undefined,
935935
session_exists: undefined,
936936
web3_missing_identifier: 'A Web3 Wallet extension cannot be found. Please install one to continue.',
937+
web3_signature_request_rejected: 'You have rejected the signature request. Please try again to continue.',
938+
web3_solana_signature_generation_failed:
939+
'An error occurred while generating the signature. Please try again to continue.',
937940
zxcvbn: {
938941
couldBeStronger: 'Your password works, but could be stronger. Try adding more characters.',
939942
goodPassword: 'Your password meets all the necessary requirements.',

packages/shared/src/types/localization.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,8 @@ type UnstableErrors = WithParamName<{
13161316
passkey_registration_cancelled: LocalizationValue;
13171317
passkey_already_exists: LocalizationValue;
13181318
web3_missing_identifier: LocalizationValue;
1319+
web3_solana_signature_generation_failed: LocalizationValue;
1320+
web3_signature_request_rejected: LocalizationValue;
13191321
form_password_pwned: LocalizationValue;
13201322
form_password_pwned__sign_in: LocalizationValue;
13211323
form_username_invalid_length: LocalizationValue<'min_length' | 'max_length'>;

0 commit comments

Comments
 (0)