getErrorMessage method
- Object e
parse Exceptions to message e
Implementation
static String getErrorMessage(Object e) {
if (e.toString().isEmpty) return 'Unable To Connect';
if (e is SocketException || e is TimeoutException) {
return 'No Internet connectivity. Please try again!';
} else if (e is HandshakeException) {
return 'Unable To Connect';
} else if (e is NoDataFound || e is IOException) {
return 'No data found!';
} else if (e.runtimeType.toString() == "UserMessageException") {
UserMessageException exception = e;
return exception.message;
}
return 'Something has gone wrong';
}