2 ms·
> we cant catch async errors outside the async callback , will generators fix this ? You can inject an exception into a generator via the throw method[0], and
by masklinn 13y ago
> we cant catch async errors outside the async callback , will generators fix this ?
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#methodthrow http://wiki.ecmascript.org/doku.php?id=harmony:generators#me...
[1] http://wiki.ecmascript.org/doku.php?id=harmony:generators#internal_methodthrow http://wiki.ecmascript.org/doku.php?id=harmony:generators#in...