fromException static method

dynamic fromException(
  1. dynamic originalException
)

Implementation

static fromException(dynamic originalException) {
  String? message;
  try {
    message = "Unknown Error Occurred";
    if (originalException.notification != null) {
      message = originalException.notification;
    }
    return UnknownFailure(message: message);
  } catch (e) {
    try {
      if (originalException.error != null) {
        message = originalException.error.toString();
      }
      return UnknownFailure(message: message);
    } catch (e) {
      try {
        if (originalException.message != null) {
          message = originalException.message;
        }
        return UnknownFailure(message: message);
      } catch (e) {
        return UnknownFailure();
      }
    }
  }
}