JobObserver class abstract mixin

Cross-cutting hooks of a single job: analytics, error reporting, a log.

Given to a job by whoever runs it — in solo, by the controller. A hook that throws hands its error to the current zone and changes nothing else: not the job's outcome, not the hook standing next to it. A Cancelled a hook throws neither reaches the zone nor cancels the job: a hook that has to calls Job.cancel. A JobAnswerer.onUnanswered that throws does not take the error it was asked about with it: that error goes to the zone first.

An observer watches: onError is told about the errors the job catches, all but its own cancellation, and answers for none. The errors nobody else has — those no outcome carries, and a failure whose outcome nobody observes — are answered by an observer that is also a JobAnswerer, and without one they go to the zone the job was created in — the same place they go when the job has no observer at all. An observer written to watch changes nowhere an error goes.

A class that already extends another one mixes this in, with JobObserver, and overrides the hooks it needs the same way. Several observers watch one job through JobObserver.all.

Implementers

Constructors

JobObserver()
Creates an observer; a subclass calls it implicitly.
JobObserver.all(Iterable<JobObserver> observers)
One observer made of observers, in their order.
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onError(Job<Object?> job, Object error, StackTrace stackTrace, {required JobErrorAnswer answer}) → void
Something the job did threw.
onFinish(Job<Object?> job) → void
A job has an outcome, including jobs dropped before start.
onLog(Job<Object?> job, Object? message) → void
A job called JobContext.log, with what it passed.
onStart(Job<Object?> job) → void
A job body is about to run.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited