FailureException.nested constructor

FailureException.nested(
  1. Exception nestedException, [
  2. StackTrace? nestedStackTrace,
  3. String? error,
  4. String? hint,
])

Simplified factory constructor for a FailureException with a nested exception. If the nested exception is a FailureException it is returned as is.

Implementation

factory FailureException.nested(
  final Exception nestedException, [
  final StackTrace? nestedStackTrace,
  final String? error,
  final String? hint,
]) {
  if (nestedException is FailureException) {
    return nestedException;
  }
  return FailureException(
    error: error,
    hint: hint,
    nestedException: nestedException,
    nestedStackTrace: nestedStackTrace,
  );
}