errors and async consequence
See original GitHub issueHello,
the current API for errors is
errors(function(err, push) {})
so we can push one or more values at the current location of the stream if we already know those values.
When you need an async operation in order to know how to react to an error, how would you organize your streams ? a consume custom transform ? a sort of push(stream) + sequence
I wonder if there is room for an API of the style
errors(function(err, push, next) {})
Issue Analytics
- State:
- Created 9 years ago
- Comments:12
Top Results From Across the Web
Handling Errors With Async Await - Thenable
The problem with using a traditional promise .catch() method is that it doesn't branch the code if an error occurs. The result variable...
Read more >Async/Await Error Handling - Beginner JavaScript - Wes Bos
We will talk about error handling strategies for async await in this lesson. Because there is no .then() that we are chaining on...
Read more >The hard error handling case made easy with async/await
Let me show a surprisingly trivial looking async/await code which is actually hard to implement correctly with Promises. There, what was so hard...
Read more >How to Simplify Asynchronous JavaScript using the Result ...
The Result-Error Pattern helps you hide try-catch blocks, simplify error handling, and encapsulate cleanup operations.
Read more >Async await usage and error handling woes - Stack Overflow
A practical answer for beginners in async/await and error handling. You cannot use await syntax outside of a function that is not declared...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would just use
consume
for this. TheonError
transform suggested in this issue isn’t implemented.You can extract this into a through-transform if you need to use it in multiple places. There are examples in the docs.
This is really old now, but exactly what I’m dealing with currently. @vqvu, @jeromew et al, what is the approach you use now-a-days?
My case is that I need to log errors in an async fashion (specifically to an AWS S3 bucket) and push the error back on the stream so that it can go and fail. Additionally, if the logging has issues, I push a new error that does a couple extra steps. The async stuff is within a promise wrapped by highland.
Is there an example in the docs of a pattern that covers this? Or alternative approaches?