fromException static method
Creates an AuthException from e
.
Implementation
static AuthException fromException(Exception e) {
if (e is AuthException) {
return e;
}
if (e is AmplifyException) {
return UnknownException(
e.message,
recoverySuggestion: e.recoverySuggestion,
underlyingException: e.underlyingException,
);
}
if (e is AWSHttpException) {
return e.toNetworkException();
}
String message;
try {
// ignore: avoid_dynamic_calls
message = (e as dynamic).message as String;
} on Object {
message = _unknownMessage;
}
return UnknownException(message, underlyingException: e);
}