Comments (7)
hey @pcowgill, thanks for the report!
makes sense, i override that error locally with this snippet: https://github.com/NoahZinsmeister/web3-react/blob/latest/src/declarations.ts#L20. looking at MDN though, it seems like name
might be the right property for what i'm trying to accomplish: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/name.
i'm going to keep the issue open and experiment with this in the next version.
from web3-react.
🙏 that sounds perfect, i'll try that!
from web3-react.
going to close this, as v6 uses custom errors which can be checked with instanceof
! thanks for bringing this up.
from web3-react.
@NoahZinsmeister Thanks for the example of how to override it! Agreed, I think name
would suit your needs here.
from web3-react.
Also, you can subclass errors so that they’ll have name set automatically in the case of a frequently used “error code”
from web3-react.
@NoahZinsmeister In the meantime, do you know of any examples of an app using this library making use of those or similar declarations? Thanks!
from web3-react.
This seems to work for an app using this lib:
ErrorWithCode.ts
export interface ErrorWithCode extends Error {
code?: string | number | undefined;
}
MyComponent.tsx
import { ErrorWithCode } from "[insert-path-here]/types/ErrorWithCode";
const {
active,
error,
setConnector,
setError
}: {
active: boolean;
error?: ErrorWithCode | null;
setConnector: any;
setError: any;
} = useWeb3Context();
(The any
type for the functions isn't good TypeScript, but left it like that since that's not the focus here.)
from web3-react.
Related Issues (20)
- Compatibility Issue with @web3-react/walletconnect-v2 and Latest Versions of Next.js and React
- When using WalletConnect v2 provider getSigner seems to be going to the v1 API HOT 1
- Issue activating walletconnect v2: this.events.off is not a function HOT 2
- Issues with having ethers 6 and web3-react side by side HOT 1
- Coinbase Connecting Issue
- Module parse failed: Unexpected token walletconnect-v2 HOT 1
- Create Fork
- @mousewifhat, kind reminder: please pay fee: **500 TWT** with the memo **27116** to the address `bnb158fgd782we4tz9vwwcj9pmmxvxhl6z46lfm7c8`.
- How to connect Trezor wallet using web3-react v8
- How can I get provider url from connected wallet? HOT 2
- Why is `connector.deactivate` always undefined? HOT 1
- **The latest updates on your projects**. Learn more about [Vercel for Git ↗︎](https://vercel.link/github-learn-more)
- Walletconect v2 chains not supported
- V3-core
- TypeError: Object(...) is not a function (WalletConnectV2) HOT 1
- How can I sign a transaction using web3-react library?
- dotnet add package dotnetstandard-bip39 --version 1.0.2
- Something happend with intendation
- How can I send transaction to ethereum via metamask?
- tags` as well.beezywqp
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from web3-react.