handleException static method
String
handleException(
- dynamic exception
)
Implementation
static String handleException(dynamic exception) {
if (exception is TimeoutException) {
return 'This is taking longer than usual, please try again.';
} else if (exception is SocketException) {
return 'No Internet connection. Please check your connection and try again.';
} else if (exception is HttpException) {
return 'Could not find the resource. Please try again.';
} else if (exception is FormatException) {
return 'Bad response format. Please contact support.';
} else {
return 'Something went wrong. Please try again later.';
}
}