How to forward errors using eventChannel?
See original GitHub issueUsing generator functions I know how to create a way to use exceptions by throwing errors:
function * foo () {
yield 1
yield 2
throw new Error('oops!')
yield 3
}
try {
for (const n of foo()) {
console.log(n)
}
} catch (err) {
console.log(`caught '${err.message}'`)
}
console.log('done!')
outputs:
1
2
caught 'oops!'
as expected.
However if I have an eventChannel
, I do not see how I can easily throw errors from it:
const myChannel = function () {
return eventChannel(function (emitter) {
const s = someSource()
.on('thing', emitter)
.on('error', () => console.log('I do not know what to do here')
.on('done', () => emitter(END))
return () => s.cancel()
}
}
Is there a way I can easily propagate errors from the eventChannel
into my sagas?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Flutter: PlatformException using EventChannel
I am trying to implement EventChannel in my flutter app by am receiving the following error: ══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ...
Read more >Handle One-Time Events with Kotlin's Channels - YouTube
In this video you will learn how you can send events that don't trigger again on screen rotation like with LiveData or StateFlow....
Read more >NE06 - NASA Event Channel - IBM Cloud Video
In addition to the services they provide to IBM, certain IBM authorized partners may also use these cookies for their own purposes. This...
Read more >Eventchannel Decoder Full Error
Substitute each <value> with your chosen value for each option and then restart the agent. With these new values the warning may go...
Read more >emctl upload agent Failed With 'EMD Upload Error:full ...
EM 12c : emctl upload agent Failed With 'EMD Upload Error:full ... Backoff event : channel=Metadata expiration at 2017-07-10 02:28:41 BST
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
Actually there is a [kind of] support for errors in
take
effects: if a take is resolved with anError
it will throw in the generator. For exampleNote that emitting an error will not abort the channel by default, if you want to end the channel after an error you’ll have to close it explicitly (for example in the catch block of the Saga)
@adipascu Added to the todo list in #1478