getError method

Exception getError([
  1. Object? ex
])

Return the current Exception object.

Implementation

Exception getError([Object? ex]) {
  Exception? e = _ex;
  if (ex == null) {
    _ex = null;
  } else {
    // ignore: avoid_as
    _ex = ex as Exception;
  }

  /// Return the stored error if any.
  e ??= _ex;
  return e!;
}