isCancellationError property
Says which errors an operation throws because the cancellation of its job stopped it, such as the error a migration throws once a token cancelled through JobContext.onCancel stops it.
Asked about each failure of a job that has accepted a cancellation, when
the job decides whether to ask for an answer to it: before
JobObserver.onError for an error no outcome carries and for a failure of
the body of a job cancelled by the time the body throws, and once the job
has ended for a failure of the body a later cancellation covers. An error
it names reaches JobObserver.onError like any other, and nobody is asked
to answer for it, neither JobAnswerer.onUnanswered nor the zone. A
failure of a job that was not cancelled is not asked about, nor is one
Job.ignoreFailure has already kept out of the answer. null, the
default, names none.
Job.isCancellationError = (error) => error is DatabaseStopped;
Called synchronously, with one failure at a time, never a Cancelled: keep it to a type test. Read at that decision, so a new one applies to no failure decided already. An overflow the body throws before its start has returned is asked about once the job has ended, or never if it cut the start short too. One that throws is an error of the app: its error goes to the zone the job was created in, before JobObserver.onError hears the failure when the decision comes first, and the failure goes on to the answer. A Cancelled it throws is dropped.
Set by the application, once, in main. A library does not set it, and
solo does not either.
Implementation
static bool Function(Object error)? isCancellationError;