Skip to content
This repository was archived by the owner on Feb 1, 2025. It is now read-only.

Commit 29d81b6

Browse files
committed
Re-throw exceptions immediately for completed generators.
This happens to fix #210 indirectly, because it causes statements like `return Promise.reject(error)` to throw, but there's a better way of fixing that bug.
1 parent 76215f1 commit 29d81b6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

runtime.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@
207207
}
208208

209209
if (state === GenStateCompleted) {
210+
if (method === "throw") {
211+
throw arg;
212+
}
213+
210214
// Be forgiving, per 25.3.3.3.3 of the spec:
211215
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
212216
return doneResult();

0 commit comments

Comments
 (0)