doOnError method

Single<T> doOnError(
  1. void onError(
    1. Object,
    2. StackTrace
    )
)

Invokes the given callback function when the Single emits an error.

Example

Single<int>.error(Exception())
  .doOnError((error, stacktrace) => print('oh no'))
  .listen(null); // prints 'Oh no'

Implementation

Single<T> doOnError(void Function(Object, StackTrace) onError) =>
    forwardSingleWithSink(
        () => _DoStreamSingleSink(onErrorCallback: onError), true);