This code demonstrates the how to combine a reading generator and a writing generator together into a duplex generator.
The duplex generator will simultaneously read and write at the same time from both the readable and writable generator.
Throwing an exception throws it to the writable generator, but we continue on (but make sure to skip 1 iteration by using the errored
flag).
We use the null
value to indicate the ending of the generator, it ends both reading and writing sides.