onError method
- Job<
Object?> job, - Object error,
- StackTrace stackTrace, {
- required JobErrorAnswer answer,
Something the job did threw.
Every error the job catches comes here once, except a Cancelled the
job ends with: its failure, and the errors no outcome carries, such as
those of cleanup, of callbacks and of work the job does not wait for. The
hook only hears an error: overriding it moves the error nowhere, and a
JobAnswerer is what answers for it. Each failure and each cancellation
inside a ParallelWaitError comes in a call of its own, as
Job.visitErrors walks it. One failure that is the outcome of several
jobs, such as a child of JobContext.run and the parent it fails, comes
once on each of them: tell the second call from a new error by
identical.
answer says what the job does about this error: see JobErrorAnswer.
Which error comes by which route, and what keeps it out of the answer, is in Where each error goes on the error rules page.
Implementation
void onError(
Job<Object?> job,
Object error,
StackTrace stackTrace, {
required JobErrorAnswer answer,
}) {}