responseData static method
dynamic
responseData(
- Response response
Implementation
static responseData(http.Response response) {
switch (response.statusCode) {
case 200:
throw SuccessException(response.body.toString());
case 204:
throw DataNotFound(null);
case 400:
throw BadRequestException(response.body.toString());
case 401:
throw UnauthorisedException(null);
case 403:
throw ForbiddenException(response.body.toString());
case 404:
throw PageNotFoundException(response.body.toString());
case 500:
throw InternalServerErrorException(response.body.toString());
case 502:
throw InternalServerErrorException(response.body.toString());
case 503:
throw InternalServerErrorException(response.body.toString());
case 504:
throw InternalServerErrorException(response.body.toString());
default:
throw FetchDataException(
'Error occurred while Communication with Server with StatusCode : ${response.statusCode}');
}
}