Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error handling #188

Merged
merged 4 commits into from
May 14, 2024
Merged

Fix error handling #188

merged 4 commits into from
May 14, 2024

Conversation

johnson86tw
Copy link
Member

@johnson86tw johnson86tw commented May 14, 2024

Error messages will still be displayed in wallet.error, and library users can decide whether to display error code 4001.

const connectError = computed(() => {
	// Ignore the error if the user rejected the connection request
	if ((<ProviderRpcError>wallet.error)?.code === 4001) {
		return null;
	}
	return wallet.error;
});

Testing Method

Connect to CoinbaseWallet, then close the modal by clicking the close button.
Connect to WalletConnect, then close the modal by clicking the close button.

Notes

To preserve the original error, including its message and code, use throw err, not throw new Error(err.message) or throw new Error(err).

@johnson86tw johnson86tw merged commit 7d93f15 into main May 14, 2024
@johnson86tw johnson86tw deleted the fix/error-handling branch May 14, 2024 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant