@piotrpalek wrote:
Hey, I’m using ember-concurrency and I’m getting this error:
TaskInstance XXX was canceled because it belongs to a XYZ Task that was .perform()ed again"
.I’ve noticed that’s because I’ve used an ember concurrency task as a promise (
task.then(...)
) but I didn’t have acatch
handler defined. Once I’ve added it (which wasn’t that obvious to me, I think this could be a good thing to add to the docs) the cancellation error was handled, but I’ve noticed that the error object in the catch handler I’m getting is just a string (same as shown in the console).So now my last issue is, how do I distinguish between cancellation errors, and possible other errors in the catch handler? Imo it’d be great if I could
import { cancellationError } from 'ember-concurrency'
and use that to ignore the cancellation error and throw if some other issue occured.edit: derp… ok I have now noticed that it’s not a string, and you can actually call
e.name
which gets youTaskCancellation
, I’ll leave this up, maybe it’ll help someone in the futureedit2: Aaaand there’s an
taskInstance
on the error object which has aisCanceled
CP, rubber duck driven development ftw
Posts: 1
Participants: 1