Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

another failing test case with delegation and errors #82

Closed
jonathanong opened this issue Feb 2, 2014 · 1 comment
Closed

another failing test case with delegation and errors #82

jonathanong opened this issue Feb 2, 2014 · 1 comment

Comments

@jonathanong
Copy link
Contributor

specifically when you delegate after you try/catch

function* test() {
  yield* sec();
  try {
    yield* sec();
  } catch (err) {}
  yield* sec();
}

function* sec(err) {
  return yield undefined;
}

var gen = test();
console.log(gen.next())
console.log(gen.next())
console.log(gen.throw(new Error('lol')))
console.log(gen.next())

0.11:

{ value: undefined, done: false }
{ value: undefined, done: false }
{ value: undefined, done: false }
{ value: undefined, done: true }

regenerator:

{ value: undefined, done: false }
{ value: undefined, done: false }

Error: lol
    at Object.<anonymous> (/Users/jong/Workspace/regenerator-test/index.js:55:23)
    at Module._compile (module.js:456:26)
    at Object.gnodeJsExtensionCompiler [as .js] (/Users/jong/.nvm/v0.10.25/lib/node_modules/gnode/index.js:61:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at Object.<anonymous> (/Users/jong/.nvm/v0.10.25/lib/node_modules/gnode/fallback.js:29:21)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

seems to be rethrowing the caught error on the second delegation.

benjamn added a commit that referenced this issue Feb 2, 2014
This is an adaptation of the failing test case reported by @jonathanong in
issue #82.
@benjamn benjamn closed this as completed in 6d66586 Feb 2, 2014
@benjamn
Copy link
Collaborator

benjamn commented Feb 3, 2014

Good catch @jonathanong! The .throw method gets less attention than .next, so thanks for taking a special interest in making sure it behaves correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants