getExceptionFromAny function

FilmGyaanException getExceptionFromAny(
  1. dynamic error
)

Returns the FilmGyaanException if any error occurs.

Implementation

FilmGyaanException 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 FilmGyaanException(error[1] as String);
    }
  }

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