File: api_error_codes.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (68 lines) | stat: -rw-r--r-- 1,755 bytes parent folder | download | duplicates (6)
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
// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef GOOGLE_APIS_COMMON_API_ERROR_CODES_H_
#define GOOGLE_APIS_COMMON_API_ERROR_CODES_H_

#include <string>

namespace google_apis {

// HTTP errors that can be returned by Google API service.
enum ApiErrorCode {
  // 200-599
  // HTTP error codes:
  HTTP_SUCCESS = 200,
  HTTP_CREATED = 201,
  HTTP_NO_CONTENT = 204,
  HTTP_FOUND = 302,
  HTTP_NOT_MODIFIED = 304,
  HTTP_RESUME_INCOMPLETE = 308,
  HTTP_BAD_REQUEST = 400,
  HTTP_UNAUTHORIZED = 401,
  HTTP_FORBIDDEN = 403,
  HTTP_NOT_FOUND = 404,
  HTTP_CONFLICT = 409,
  HTTP_GONE = 410,
  HTTP_LENGTH_REQUIRED = 411,
  HTTP_PRECONDITION = 412,
  HTTP_INTERNAL_SERVER_ERROR = 500,
  HTTP_NOT_IMPLEMENTED = 501,
  HTTP_BAD_GATEWAY = 502,
  HTTP_SERVICE_UNAVAILABLE = 503,

  // 900-999
  // Common API error codes:
  NO_CONNECTION = 900,
  NOT_READY = 901,
  OTHER_ERROR = 902,
  CANCELLED = 903,
  PARSE_ERROR = 904,

  // 1000-1999
  // Drive API error codes:
  DRIVE_FILE_ERROR = 1000,
  DRIVE_NO_SPACE = 1001,
  DRIVE_RESPONSE_TOO_LARGE = 1002,

  // 2000-2099
  // YouTube Music error codes:
  YOUTUBE_MUSIC_UPDATE_REQUIRED = 2000,

  // Needed in order to log this in UMA.
  kMaxValue = YOUTUBE_MUSIC_UPDATE_REQUIRED,
};

// Returns a string representation of ApiErrorCode.
std::string ApiErrorCodeToString(ApiErrorCode error);

// Checks if the error code represents success for drive api.
bool IsSuccessfulDriveApiErrorCode(ApiErrorCode error);

// Checks if the error code represents success for calendar api.
bool IsSuccessfulCalendarApiErrorCode(ApiErrorCode error);

}  // namespace google_apis

#endif  // GOOGLE_APIS_COMMON_API_ERROR_CODES_H_