getSaveResponse<ContainerDataTypeGeneric> method
Implementation
Future<GoogleHTTPResponse> getSaveResponse<ContainerDataTypeGeneric>(
Future futureResponse) async {
GoogleHTTPResponse response = GoogleHTTPResponse(
http.Response('', 404),
null,
);
try {
final HttpResponse httpResponse = await futureResponse;
response = httpResponseToCustomHttpResponse(httpResponse);
} catch (e) {
if (e is HttpResponse) {
response = httpResponseToCustomHttpResponse(e);
} else if (e is dio.DioException) {
switch (e.type) {
case dio.DioExceptionType.connectionTimeout:
case dio.DioExceptionType.receiveTimeout:
case dio.DioExceptionType.sendTimeout:
throw TimeoutException(e.message);
default:
}
if (e.error is Exception) throw e.error as Exception;
response = dioErrorToCustomHttpResponse(e);
} else {
rethrow;
}
}
return response;
}