-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
error
event for error handling
#61
Comments
What would the behavior be? Would it both reject on |
Good question! I am not so sure myself, any suggestion? I am leaning towards having both and leave it up to the user to choose what he needs base on his usecase... |
I think it would be weird to do both. Then the user would have to both listen to an If we would go for an |
Ok. Well for having both, I did not really mean it as he would have to use both, but as he could choose based on his use-case (eq. if he has only one listener, than he can try/catch and if he would have multiple listeners then he can listen on the |
Currently, when you call
emit()
you can attache.catch()
to the returned Promise for error handling. It has a limitation coming from Promise side as Promise can be only once resolved or rejected. But you can have multiple listeners for the event and if multiple listneres errors out then you will be notified only about the first one.I would like to propose to have defined event name (
error
seems like good name and follows also similar event in the Node'sEventEmitter
) which would be called upon listener's error throw or rejection with the object passed with structure:The text was updated successfully, but these errors were encountered: