Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Very cool. I'm glad you went the whole way and transformed everything, including try/catch. I'm assuming it handles exceptions properly in the dynamic context? Take the following code:

  try {
    foo();
    yield i;
  }
  catch(e) {
    console.log(e);
  }
If `foo` throws an exception, I handle it, right? I don't see your generator wrapped in an exception handler, but maybe `wrapGenerator` does it.


Exactly, the `wrapGenerator` function provides a small runtime that (among other things) handles uncaught exceptions: https://github.com/facebook/regenerator/blob/master/runtime/...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: