-
Notifications
You must be signed in to change notification settings - Fork 0
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
docs: creating steps, context.error() #18
Conversation
|
Netlify preview deployed to https://18-merge--peppy-toffee-c61eab.netlify.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can add one more section covering the related problem of resource cleanup: remember we had to subscribe to events here to ensure finalization code runs also when an exception is thrown by another step
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, remind me. Did we in the end understand why that event handler was necessary? Why wasn't store.dispose
called by the sort function enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when an exception is thrown by a later step in the pipeline, the async generator is stopped without running its finally
block, the event handlers are the only way we could find to ensure finalization code is called. I may try to create a small repro to show the problem and how to address it
|
||
1. When using through2, it is not possible to capture a specific `before` stage. Any additional data must be pushed in the `flush` callback. | ||
- Alternatively, a library like [onetime](https://npm.im/onetime) can be used to create `before` stage is only executed once. | ||
2. The stream transform and flush functions are not bound to the context. This means that the context must be captured in a closure, or they must be implemented as arrow functions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been tricked by this a few times, glad to see an explanation
Co-authored-by: Giacomo Citi <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice choice of a working example
No description provided.