getLocalizedMessageFromException method
Implement this method when checked what exceptions could be
Implementation
String? getLocalizedMessageFromException(dynamic exception) {
if (exception == null) return null;
if (exception is AdeptUtils.GenericException) {
return getLocalizedMessageFromException(exception.causeException);
}
if (exception is WebSocketException ||
exception is TimeoutException ||
exception.toString().toLowerCase().contains("TimeoutException")) {
return "Server connection timeout.";
}
if (exception is SocketException ||
exception.toString().toLowerCase().contains("failed to connect")) {
return "Check your internet connection. ${exception.toString()}";
}
if (exception is HandshakeException) return exception.toString();
return exception.toString();
}