ember-concurrency icon indicating copy to clipboard operation
ember-concurrency copied to clipboard

'run to completion' error if exception thrown in task

Open BryanCrotaz opened this issue 7 years ago • 4 comments

@restartableTask *_debounce(this:MyClass) { yield timeout(250); this._doWork(); } This gives an assertion error if this._doWork throws. In my case it was using a non existent variable. Assertion Failed: The task generator function has already run to completion. This is probably an ember-concurrency bug.

BryanCrotaz avatar Sep 03 '18 19:09 BryanCrotaz

@BryanCrotaz can you reproduce in a Twiddle?

machty avatar Sep 03 '18 21:09 machty

No. It gives the correct missing variable error. My guess is it's some combination of typescript/ES6/ember-concurrency-decorator.

BryanCrotaz avatar Sep 03 '18 22:09 BryanCrotaz

If I fix the missing variable typo in my code the problem goes away.

BryanCrotaz avatar Sep 03 '18 22:09 BryanCrotaz

Are you using ember-cli-typescript or ember-cli-babel with TypeScript compatibility?

Is it only with @restartableTask or @task as well?

What about...?

@restartableTask
_debounce = function*(this: MyClass) {
  yield timeout(250);
  this._doWork();
}

I know that Babel had / has trouble with decorating generator methods, as in your example. The initializer form, as shown above, has always worked so far.

If this is not the cause, maybe it's the this type?

buschtoens avatar Sep 04 '18 07:09 buschtoens