fromException static method
Creates an AnalyticsException from an Exception.
Implementation
static AnalyticsException fromException(Exception e) {
if (e is AnalyticsException) {
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);
}