Skip to content

Commit 5452001

Browse files
committed
use yarn; docstring fixup
1 parent 53d76f6 commit 5452001

File tree

8 files changed

+1747
-2132
lines changed

8 files changed

+1747
-2132
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Changelog
22

33
## 2.0.0 (Current)
4+
45
- **Exports**
56
- `errors` renamed `ethErrors`
67
- `JsonRpcError` renamed `EthereumRpcError`
@@ -30,6 +31,7 @@
3031
- Updated affected interfaces
3132

3233
## 1.1.0
34+
3335
- `serializeError`
3436
- If the object passed to the function has a `.message` property,
3537
it will preferred over the `.message` property of the fallback error when

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# eth-json-rpc-errors
22

33
Errors for the
4-
[Ethereum JSON RPC](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1474.md)
4+
[Ethereum JSON RPC](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1474.md)
55
and
66
[Ethereum Provider](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md),
77
and [making unknown errors compliant with either spec](#parsing-unknown-errors).
88

99
## Basic Usage
10+
1011
```js
1112
import { ethErrors } from 'eth-json-rpc-errors'
1213

@@ -27,7 +28,7 @@ throw ethErrors.provider.unauthorized('my custom message')
2728

2829
## Usage
2930

30-
Installation: `npm install eth-json-rpc-errors`
31+
Installation: `npm install eth-json-rpc-errors` or `yarn add eth-json-rpc-errors`
3132

3233
Import using ES6 syntax (no default export) or Node `require`.
3334

@@ -74,6 +75,7 @@ response.error = ethErrors.provider.custom({
7475
```
7576

7677
### Parsing Unknown Errors
78+
7779
```js
7880
// this is useful for ensuring your errors are standardized
7981
import { serializeError } from 'eth-json-rpc-errors'
@@ -82,7 +84,7 @@ import { serializeError } from 'eth-json-rpc-errors'
8284
// it will be added as error.data.originalError
8385
response.error = serializeError(maybeAnError)
8486

85-
// you can add a custom fallback error code and message if desired
87+
// you can add a custom fallback error code and message if desired
8688
const fallbackError = { code: 4999, message: 'My custom error.' }
8789
response.error = serializeError(maybeAnError, fallbackError)
8890

@@ -97,14 +99,15 @@ response.error = serializeError(maybeAnError, fallbackError)
9799
```
98100

99101
### Other Exports
102+
100103
```js
101104
/**
102105
* TypeScript interfaces
103106
*/
104107
import {
105108
// these describe to the corresponding exports from index.js
106109
IEthErrors, IEthereumRpcError, IEthereumProviderError, ISerializeError,
107-
// these describe the options argument to error getters in ethErrors
110+
// these describe the options argument to error getters in ethErrors
108111
IErrorOptions, IRpcServerErrorOptions, IProviderCustomErrorOptions
109112
} from 'eth-json-rpc-errors/@types'
110113

0 commit comments

Comments
 (0)