Index: google_apis/drive/drive_api_requests.cc |
diff --git a/google_apis/drive/drive_api_requests.cc b/google_apis/drive/drive_api_requests.cc |
index 307e5411477dd7e4c935af33f141b95119bf98c8..9d6c29fd29ab9ca2ce24edd7da7d4122d207abca 100644 |
--- a/google_apis/drive/drive_api_requests.cc |
+++ b/google_apis/drive/drive_api_requests.cc |
@@ -1394,11 +1394,18 @@ std::vector<std::string> BatchUploadRequest::GetExtraRequestHeaders() const { |
void BatchUploadRequest::ProcessURLFetchResults(const net::URLFetcher* source) { |
// Return the detailed raw HTTP code if the error code is abstracted |
- // DRIVE_OTHER_ERROR. |
- UMA_HISTOGRAM_SPARSE_SLOWLY(kUMADriveBatchUploadResponseCode, |
- GetErrorCode() != DRIVE_OTHER_ERROR |
- ? GetErrorCode() |
- : source->GetResponseCode()); |
+ // DRIVE_OTHER_ERROR. If HTTP connection is failed and the status code is -1, |
+ // return network status error. |
+ int histogram_error = 0; |
+ if (GetErrorCode() != DRIVE_OTHER_ERROR) { |
+ histogram_error = GetErrorCode(); |
+ } else if (source->GetResponseCode() != -1) { |
+ histogram_error = source->GetResponseCode(); |
+ } else { |
+ histogram_error = source->GetStatus().error(); |
+ } |
+ UMA_HISTOGRAM_SPARSE_SLOWLY( |
+ kUMADriveBatchUploadResponseCode, histogram_error); |
if (!IsSuccessfulDriveApiErrorCode(GetErrorCode())) { |
RunCallbackOnPrematureFailure(GetErrorCode()); |