• Robin Obůrka's avatar
    msgloop: Don't use generator for in-out boxes - refactor to closures · d16bbc90
    Robin Obůrka authored
    I found that any exception raised from generator ends with StopIteration
    at next next() call. So, the solution wasn't able to provide
    bulletproof solution for unexpected errors.
    This solution uses some other nice-to-look-at shortcut to not duplicate
    code that is based on closures.
    I'm able to protect in-out boxes against unexpected errors. I'm not
    able to do the same for out-only boxes based on generators, but it is
    better than nothing.
    Boxes generating messages should know what they are doing, so they
    shouldn't need so much effort.
msgloop.py 5.25 KB