This repository has been archived by the owner on Feb 13, 2024. It is now read-only.
Ensure callback is called when invoking errorHanlder #347
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I work at Trello @ Atlassian.
We use this library, however, it started causing problems for us when
throw err
was added to the.flush()
method. This has been documented here. (#320) For us it was resulting in process crashes when we receive an error message (like a 429) when emitting an event. We had to pin the version of this library to a version before this behavior was added.I saw, that the
errorHandler
property was added (#342) and was attempting to update our code to use it, however, when writing a test case, I saw that my event callback was never invoked whenerrorHandler
was present and calledThis is because, in the
.flush()
, everywhere else the method can end, we calldone(err)
, however we do not when looking for and invoking theerrorHandler
. To reiterate the importance, it's a core bit of functionality of this library that the callbacks for events are invoked when the messages are flushed, so it's needs to occur in this instance as well.