getExceptionFromAny function

BreakingBadQuotesException getExceptionFromAny(
  1. dynamic error
)

Returns the BreakingBadQuotesException if any error occurs.

Implementation

BreakingBadQuotesException getExceptionFromAny(dynamic error) {
  if (error is DefaultResult) {
    return getExceptionFromDefaultResult(error);
  }

  if (error is List) {
    if (error.isEmpty) {
      return UnknownException();
    } else if (error.length == 3) {
      return BreakingBadQuotesException(error[1] as String);
    }
  }

  return BreakingBadQuotesException('unknown exception: $error');
}