Skip to content

Commit 9e435a4

Browse files
authored
Update README.md to accurately describe silent error event (#1991)
* Update README.md to accurately describe silent `error` event * Update README.md to add caveat of when `lazyConnect` is true
1 parent 7d60f00 commit 9e435a4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ The Redis instance will emit some events about the state of the connection to th
826826
| :----------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
827827
| connect | emits when a connection is established to the Redis server. |
828828
| ready | If `enableReadyCheck` is `true`, client will emit `ready` when the server reports that it is ready to receive commands (e.g. finish loading data from disk).<br>Otherwise, `ready` will be emitted immediately right after the `connect` event. |
829-
| error | emits when an error occurs while connecting.<br>When `lazyConnect` is false, ioredis emits all `error` events silently (only emits when there's at least one listener) so that your application won't crash if you're not listening to the `error` event.<br> However when `lazyConnect` is true and `redis.connect()` is explicitly called it will return a promise which might reject with an error. If `redis.connect()` is not called explicitly, ioredis will try to connect automatically on the first command and emit the `error` event silently. |
829+
| error | emits when an error occurs while connecting.<br>However, ioredis emits all `error` events silently (only emits when there's at least one listener) so that your application won't crash if you're not listening to the `error` event.<br>When `redis.connect()` is explicitly called the error will also be rejected from the returned promise, in addition to emitting it. If `redis.connect()` is not called explicitly and `lazyConnect` is true, ioredis will try to connect automatically on the first command and emit the `error` event silently. |
830830
| close | emits when an established Redis server connection has closed. |
831831
| reconnecting | emits after `close` when a reconnection will be made. The argument of the event is the time (in ms) before reconnecting. |
832832
| end | emits after `close` when no more reconnections will be made, or the connection is failed to establish. |

0 commit comments

Comments
 (0)