getErrorMessage static method
Implementation
static String getErrorMessage(NetException netException) {
var errorMessage = "";
netException.when(badRequest: () {
errorMessage = 'Bad request';
}, unauthorisedRequest: () {
errorMessage = 'Unauthorised request';
}, notFound: () {
errorMessage = 'Not found';
}, internalServerError: () {
errorMessage = 'Internal Server Error';
}, serviceUnavailable: () {
errorMessage = 'Service unavailable';
}, noInternetConnection: () {
errorMessage = 'No Internet Connection';
}, timeout: () {
errorMessage = 'Timeout';
}, formatException: () {
errorMessage = 'Unable to process the data';
}, unableToProcess: () {
errorMessage = 'Unable to process the data';
}, defaultError: (String error) {
errorMessage = error;
}, unexpectedError: () {
errorMessage = 'Unexpected error occurred';
});
return errorMessage;
}