I tried to figure out how to catch a connection error which was already mentioned in several other issues. Apparently, the way to do it is:
const emitter = redis();
emitter.state.once('error', () => console.log(error))
This has a problem though: state is not in the type definitions - I just found out about this by looking at the test file. It also took way too long to find out about this so it should be documented in a better way.
I would propose
- adding a section to the Readme documenting this
- one of the following possibilities regarding
state not being in the type defs
- Adding
state to type defs
- Adding a separate function to the type defs, e.g.
onError (if you don't want to expose the EventEmitter like that)
- Somehow redirecting the events that go to
state so that they can be caught with emitter.on.
What do you think would be best?
I tried to figure out how to catch a connection error which was already mentioned in several other issues. Apparently, the way to do it is:
This has a problem though:
stateis not in the type definitions - I just found out about this by looking at the test file. It also took way too long to find out about this so it should be documented in a better way.I would propose
statenot being in the type defsstateto type defsonError(if you don't want to expose theEventEmitterlike that)stateso that they can be caught withemitter.on.What do you think would be best?