You can inject an exception into a generator via the throw method[0], and it'll be raised at the yield, as if `yield` had thrown[1].
JS exception handling facilities are still crap, though.
[0] http://wiki.ecmascript.org/doku.php?id=harmony:generators#me...
[1] http://wiki.ecmascript.org/doku.php?id=harmony:generators#in...
You can inject an exception into a generator via the throw method[0], and it'll be raised at the yield, as if `yield` had thrown[1].
JS exception handling facilities are still crap, though.
[0] http://wiki.ecmascript.org/doku.php?id=harmony:generators#me...
[1] http://wiki.ecmascript.org/doku.php?id=harmony:generators#in...