-
Notifications
You must be signed in to change notification settings - Fork 513
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
connectWallet does not throw error #1920
Comments
Hello @YaminZheng 👋 If I am understanding correctly you want to use the import { useOnboard } from "@web3-onboard/vue";
const { connectWallet, connectedWallet } = useOnboard();
const onClickConnect = async () => {
try {
await connectWallet({ label: 'a error label', disableModels: true });
// Here you can add logic if the wallet you wanted to autoSelect wasn't selected
if(!connectedWallet) {
console.log('Could not find wallet to auto connect')
}
} catch (err) {
alert('Unknown wallet or other error');
}
}; |
Sorry, my English is not good, I mean |
@YaminZheng adding this translation for context: Are you saying that you are not able to get the provider thrown error? i.e. if metamask throws an error you want to see and be able to catch that error? |
Yes, not just metamask, but any other errors if they exist |
Current Behavior
try {
await connectWallet({ label: 'a error label', disableModels: true })
} catch (err) {
// No error, it's always connecting
}
Expected Behavior
When I cancel, or pass in an unknown wallet, an error should be thrown so the code can handle it!
Steps To Reproduce
import { useOnboard } from "@web3-onboard/vue";
const { connectWallet } = useOnboard();
const onClickConnect = async () => {
try {
await connectWallet({ label: 'a error label', disableModels: true })
} catch (err) {
alert('Unknown wallet or other error')
}
}
What package is effected by this issue?
@web3-onboard/vue
Is this a build or a runtime issue?
Runtime
Package Version
2.7.11
Node Version
v18.16.1
What browsers are you seeing the problem on?
Chrome
Relevant log output
No response
Anything else?
No response
Sanity Check
The text was updated successfully, but these errors were encountered: