1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "chrome/browser/google_apis/gdata_errorcode.h" 6 7 #include "base/logging.h" 8 #include "base/strings/string_number_conversions.h" 9 10 namespace google_apis { 11 12 std::string GDataErrorCodeToString(GDataErrorCode error) { 13 switch (error) { 14 case HTTP_SUCCESS: 15 return"HTTP_SUCCESS"; 16 17 case HTTP_CREATED: 18 return"HTTP_CREATED"; 19 20 case HTTP_NO_CONTENT: 21 return"HTTP_NO_CONTENT"; 22 23 case HTTP_FOUND: 24 return"HTTP_FOUND"; 25 26 case HTTP_NOT_MODIFIED: 27 return"HTTP_NOT_MODIFIED"; 28 29 case HTTP_RESUME_INCOMPLETE: 30 return"HTTP_RESUME_INCOMPLETE"; 31 32 case HTTP_BAD_REQUEST: 33 return"HTTP_BAD_REQUEST"; 34 35 case HTTP_UNAUTHORIZED: 36 return"HTTP_UNAUTHORIZED"; 37 38 case HTTP_FORBIDDEN: 39 return"HTTP_FORBIDDEN"; 40 41 case HTTP_NOT_FOUND: 42 return"HTTP_NOT_FOUND"; 43 44 case HTTP_CONFLICT: 45 return"HTTP_CONFLICT"; 46 47 case HTTP_LENGTH_REQUIRED: 48 return"HTTP_LENGTH_REQUIRED"; 49 50 case HTTP_PRECONDITION: 51 return"HTTP_PRECONDITION"; 52 53 case HTTP_INTERNAL_SERVER_ERROR: 54 return"HTTP_INTERNAL_SERVER_ERROR"; 55 56 case HTTP_NOT_IMPLEMENTED: 57 return "HTTP_NOT_IMPLEMENTED"; 58 59 case HTTP_BAD_GATEWAY: 60 return"HTTP_BAD_GATEWAY"; 61 62 case HTTP_SERVICE_UNAVAILABLE: 63 return"HTTP_SERVICE_UNAVAILABLE"; 64 65 case GDATA_PARSE_ERROR: 66 return"GDATA_PARSE_ERROR"; 67 68 case GDATA_FILE_ERROR: 69 return"GDATA_FILE_ERROR"; 70 71 case GDATA_CANCELLED: 72 return"GDATA_CANCELLED"; 73 74 case GDATA_OTHER_ERROR: 75 return"GDATA_OTHER_ERROR"; 76 77 case GDATA_NO_CONNECTION: 78 return"GDATA_NO_CONNECTION"; 79 80 case GDATA_NOT_READY: 81 return"GDATA_NOT_READY"; 82 83 case GDATA_NO_SPACE: 84 return"GDATA_NO_SPACE"; 85 } 86 87 return "UNKNOWN_ERROR_" + base::IntToString(error); 88 } 89 90 } // namespace google_apis 91