OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/sync_file_system/drive_file_sync_util.h" | 5 #include "chrome/browser/sync_file_system/drive_file_sync_util.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace sync_file_system { | 9 namespace sync_file_system { |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 case google_apis::HTTP_FORBIDDEN: | 49 case google_apis::HTTP_FORBIDDEN: |
50 case google_apis::HTTP_LENGTH_REQUIRED: | 50 case google_apis::HTTP_LENGTH_REQUIRED: |
51 case google_apis::HTTP_PRECONDITION: | 51 case google_apis::HTTP_PRECONDITION: |
52 case google_apis::GDATA_PARSE_ERROR: | 52 case google_apis::GDATA_PARSE_ERROR: |
53 case google_apis::GDATA_OTHER_ERROR: | 53 case google_apis::GDATA_OTHER_ERROR: |
54 return SYNC_STATUS_FAILED; | 54 return SYNC_STATUS_FAILED; |
55 | 55 |
56 case google_apis::GDATA_NO_SPACE: | 56 case google_apis::GDATA_NO_SPACE: |
57 return SYNC_FILE_ERROR_NO_SPACE; | 57 return SYNC_FILE_ERROR_NO_SPACE; |
58 } | 58 } |
59 NOTREACHED(); | 59 |
| 60 // There's a case where DriveService layer returns GDataErrorCode==-1 |
| 61 // when network is unavailable. (http://crbug.com/223042) |
| 62 // TODO(kinuko,nhiroki): We should identify from where this undefined error |
| 63 // code is coming. |
| 64 if (error == -1) |
| 65 return SYNC_STATUS_NETWORK_ERROR; |
| 66 |
| 67 LOG(WARNING) << "Got unexpected error: " << error; |
60 return SYNC_STATUS_FAILED; | 68 return SYNC_STATUS_FAILED; |
61 } | 69 } |
62 | 70 |
63 google_apis::GDataErrorCode DriveUploadErrorToGDataErrorCode( | 71 google_apis::GDataErrorCode DriveUploadErrorToGDataErrorCode( |
64 google_apis::DriveUploadError error) { | 72 google_apis::DriveUploadError error) { |
65 switch (error) { | 73 switch (error) { |
66 case google_apis::DRIVE_UPLOAD_OK: | 74 case google_apis::DRIVE_UPLOAD_OK: |
67 return google_apis::HTTP_SUCCESS; | 75 return google_apis::HTTP_SUCCESS; |
68 case google_apis::DRIVE_UPLOAD_ERROR_NOT_FOUND: | 76 case google_apis::DRIVE_UPLOAD_ERROR_NOT_FOUND: |
69 return google_apis::HTTP_NOT_FOUND; | 77 return google_apis::HTTP_NOT_FOUND; |
70 case google_apis::DRIVE_UPLOAD_ERROR_NO_SPACE: | 78 case google_apis::DRIVE_UPLOAD_ERROR_NO_SPACE: |
71 return google_apis::GDATA_NO_SPACE; | 79 return google_apis::GDATA_NO_SPACE; |
72 case google_apis::DRIVE_UPLOAD_ERROR_CONFLICT: | 80 case google_apis::DRIVE_UPLOAD_ERROR_CONFLICT: |
73 return google_apis::HTTP_CONFLICT; | 81 return google_apis::HTTP_CONFLICT; |
74 case google_apis::DRIVE_UPLOAD_ERROR_ABORT: | 82 case google_apis::DRIVE_UPLOAD_ERROR_ABORT: |
75 return google_apis::GDATA_OTHER_ERROR; | 83 return google_apis::GDATA_OTHER_ERROR; |
76 } | 84 } |
77 NOTREACHED(); | 85 NOTREACHED(); |
78 return google_apis::GDATA_OTHER_ERROR; | 86 return google_apis::GDATA_OTHER_ERROR; |
79 } | 87 } |
80 | 88 |
81 } // namespace sync_file_system | 89 } // namespace sync_file_system |
OLD | NEW |