1- # eth- rpc-errors
1+ # ` @metamask/ rpc-errors`
22
3- Ethereum RPC errors, including for
3+ JSON- RPC errors, including for
44[ Ethereum JSON RPC] ( https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1474.md )
55and
66[ Ethereum Provider] ( https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md ) ,
@@ -11,7 +11,7 @@ and [making unknown errors compliant with either spec](#parsing-unknown-errors).
1111In TypeScript or JavaScript:
1212
1313``` js
14- import { ethErrors } from ' eth- rpc-errors'
14+ import { ethErrors } from ' @metamask/ rpc-errors'
1515
1616throw ethErrors .provider .unauthorized ()
1717// or
@@ -30,7 +30,7 @@ throw ethErrors.provider.unauthorized('my custom message')
3030
3131## Usage
3232
33- Installation: ` npm install eth- rpc-errors ` or ` yarn add eth- rpc-errors `
33+ Installation: ` npm install @metamask/ rpc-errors ` or ` yarn add @metamask/ rpc-errors `
3434
3535` import ` or ` require ` as normal (no default export).
3636
@@ -45,7 +45,7 @@ yarn test
4545### Errors API
4646
4747``` js
48- import { ethErrors } from ' eth- rpc-errors'
48+ import { ethErrors } from ' @metamask/ rpc-errors'
4949
5050// Ethereum RPC errors are namespaced under "ethErrors.rpc"
5151response .error = ethErrors .rpc .methodNotFound ({
@@ -88,7 +88,7 @@ response.error = ethErrors.provider.custom({
8888
8989``` js
9090// this is useful for ensuring your errors are standardized
91- import { serializeError } from ' eth- rpc-errors'
91+ import { serializeError } from ' @metamask/ rpc-errors'
9292
9393// if the argument is not a valid error per any supported spec,
9494// it will be added as error.data.originalError
@@ -114,12 +114,12 @@ response.error = serializeError(maybeAnError, fallbackError)
114114/**
115115 * Classes
116116 */
117- import { EthereumRpcError , EthereumProviderError } from ' eth- rpc-errors'
117+ import { EthereumRpcError , EthereumProviderError } from ' @metamask/ rpc-errors'
118118
119119/**
120120 * getMessageFromCode and errorCodes
121121 */
122- import { getMessageFromCode , errorCodes } from ' eth- rpc-errors'
122+ import { getMessageFromCode , errorCodes } from ' @metamask/ rpc-errors'
123123
124124// get the default message string for the given code, or a fallback message if
125125// no message exists for the given code
0 commit comments