recordException method

Object? recordException([
  1. Object? error,
  2. StackTrace? stack
])

Return the 'last' error if any.

Implementation

Object? recordException([Object? error, StackTrace? stack]) {
  // Retrieved the currently recorded exception
  var e = _recErrorException;

  if (error == null) {
    // Once retrieved, empty this
    _recErrorException = null;
    _stackTrace = null;
  } else {
    //
    _recErrorException = error;
    _stackTrace = stack;
  }
  return e;
}