exception property

  1. @override
Exception exception
override

The exception given when one of the merged tokens was cancelled.

On debug builds this will throw an exception if the token hasn't been called yet. On release builds a fallback CancelledException will be returned to prevent unexpected exceptions.

If the MergedCancellationToken wasn't attached to any cancellables at the time of cancellation, this will return the exception of the first cancelled token in the list of merged tokens. Otherwise, the exception from the merged token that was cancelled first will be used.

Implementation

@override
Exception get exception {
  _updateCancellationStatus();
  assert(
    isCancelled,
    'Attempted to get the cancellation exception of a $runtimeType that '
    'hasn\'t been cancelled yet.',
  );
  return _exception ?? CancelledException();
}