forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdrive_api_error_codes.cc
99 lines (67 loc) · 2.14 KB
/
drive_api_error_codes.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "google_apis/drive/drive_api_error_codes.h"
#include "base/strings/string_number_conversions.h"
namespace google_apis {
std::string DriveApiErrorCodeToString(DriveApiErrorCode error) {
switch (error) {
case HTTP_SUCCESS:
return "HTTP_SUCCESS";
case HTTP_CREATED:
return "HTTP_CREATED";
case HTTP_NO_CONTENT:
return "HTTP_NO_CONTENT";
case HTTP_FOUND:
return "HTTP_FOUND";
case HTTP_NOT_MODIFIED:
return "HTTP_NOT_MODIFIED";
case HTTP_RESUME_INCOMPLETE:
return "HTTP_RESUME_INCOMPLETE";
case HTTP_BAD_REQUEST:
return "HTTP_BAD_REQUEST";
case HTTP_UNAUTHORIZED:
return "HTTP_UNAUTHORIZED";
case HTTP_FORBIDDEN:
return "HTTP_FORBIDDEN";
case HTTP_NOT_FOUND:
return "HTTP_NOT_FOUND";
case HTTP_CONFLICT:
return "HTTP_CONFLICT";
case HTTP_GONE:
return "HTTP_GONE";
case HTTP_LENGTH_REQUIRED:
return "HTTP_LENGTH_REQUIRED";
case HTTP_PRECONDITION:
return "HTTP_PRECONDITION";
case HTTP_INTERNAL_SERVER_ERROR:
return "HTTP_INTERNAL_SERVER_ERROR";
case HTTP_NOT_IMPLEMENTED:
return "HTTP_NOT_IMPLEMENTED";
case HTTP_BAD_GATEWAY:
return "HTTP_BAD_GATEWAY";
case HTTP_SERVICE_UNAVAILABLE:
return "HTTP_SERVICE_UNAVAILABLE";
case DRIVE_PARSE_ERROR:
return "DRIVE_PARSE_ERROR";
case DRIVE_FILE_ERROR:
return "DRIVE_FILE_ERROR";
case DRIVE_CANCELLED:
return "DRIVE_CANCELLED";
case DRIVE_OTHER_ERROR:
return "DRIVE_OTHER_ERROR";
case DRIVE_NO_CONNECTION:
return "DRIVE_NO_CONNECTION";
case DRIVE_NOT_READY:
return "DRIVE_NOT_READY";
case DRIVE_NO_SPACE:
return "DRIVE_NO_SPACE";
case DRIVE_RESPONSE_TOO_LARGE:
return "DRIVE_RESPONSE_TOO_LARGE";
}
return "UNKNOWN_ERROR_" + base::NumberToString(error);
}
bool IsSuccessfulDriveApiErrorCode(DriveApiErrorCode error) {
return 200 <= error && error <= 299;
}
} // namespace google_apis