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 a catch
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 you TaskCancellation
, I’ll leave this up, maybe it’ll help someone in the future
edit2: Aaaand there’s an taskInstance
on the error object which has a isCanceled
CP, rubber duck driven development ftw