-
-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better documentation for catching errors #42
Comments
Can you send a PR to add state to the typedefs? |
I tried doing that but it seems like it is completely impossible to catch the error. This is a repo that shows it: https://github.com/puchm/mqemitter-redis-issue Run This can crash a server without the dev being able to catch it so we should fix this as soon as possible. What could be the cause of this? |
This seems to be related to redis/ioredis#944. Another possible solution is shown in redis/ioredis#68 and here: https://stackoverflow.com/a/61133867/9144769 I tried finding a solution but I couldn't get any of these to work. Could it be the case that there are calls to the Redis server when initializing the instance, other than the connection? I think there may be calls to redis before the connection is established. |
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:
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
state
not being in the type defsstate
to type defsonError
(if you don't want to expose theEventEmitter
like that)state
so that they can be caught withemitter.on
.What do you think would be best?
The text was updated successfully, but these errors were encountered: