comparison PalantirCppClient/HttpException.cpp @ 43:9be852ad33d2

rename for c
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 04 Sep 2012 09:59:34 +0200
parents 3959d33612cc
children
comparison
equal deleted inserted replaced
42:ea48f38afe5f 43:9be852ad33d2
29 29
30 namespace Palantir 30 namespace Palantir
31 { 31 {
32 const char* HttpException::What() const 32 const char* HttpException::What() const
33 { 33 {
34 if (status_ == HttpStatus_None) 34 if (status_ == Palantir_HttpStatus_None)
35 { 35 {
36 return custom_.c_str(); 36 return custom_.c_str();
37 } 37 }
38 else 38 else
39 { 39 {
40 return GetDescription(status_); 40 return GetDescription(status_);
41 } 41 }
42 } 42 }
43 43
44 const char* HttpException::GetDescription(HttpStatus status) 44 const char* HttpException::GetDescription(Palantir_HttpStatus status)
45 { 45 {
46 switch (status) 46 switch (status)
47 { 47 {
48 case HttpStatus_100_Continue: 48 case Palantir_HttpStatus_100_Continue:
49 return "Continue"; 49 return "Continue";
50 50
51 case HttpStatus_101_SwitchingProtocols: 51 case Palantir_HttpStatus_101_SwitchingProtocols:
52 return "Switching Protocols"; 52 return "Switching Protocols";
53 53
54 case HttpStatus_102_Processing: 54 case Palantir_HttpStatus_102_Processing:
55 return "Processing"; 55 return "Processing";
56 56
57 case HttpStatus_200_Ok: 57 case Palantir_HttpStatus_200_Ok:
58 return "OK"; 58 return "OK";
59 59
60 case HttpStatus_201_Created: 60 case Palantir_HttpStatus_201_Created:
61 return "Created"; 61 return "Created";
62 62
63 case HttpStatus_202_Accepted: 63 case Palantir_HttpStatus_202_Accepted:
64 return "Accepted"; 64 return "Accepted";
65 65
66 case HttpStatus_203_NonAuthoritativeInformation: 66 case Palantir_HttpStatus_203_NonAuthoritativeInformation:
67 return "Non-Authoritative Information"; 67 return "Non-Authoritative Information";
68 68
69 case HttpStatus_204_NoContent: 69 case Palantir_HttpStatus_204_NoContent:
70 return "No Content"; 70 return "No Content";
71 71
72 case HttpStatus_205_ResetContent: 72 case Palantir_HttpStatus_205_ResetContent:
73 return "Reset Content"; 73 return "Reset Content";
74 74
75 case HttpStatus_206_PartialContent: 75 case Palantir_HttpStatus_206_PartialContent:
76 return "Partial Content"; 76 return "Partial Content";
77 77
78 case HttpStatus_207_MultiStatus: 78 case Palantir_HttpStatus_207_MultiStatus:
79 return "Multi-Status"; 79 return "Multi-Status";
80 80
81 case HttpStatus_208_AlreadyReported: 81 case Palantir_HttpStatus_208_AlreadyReported:
82 return "Already Reported"; 82 return "Already Reported";
83 83
84 case HttpStatus_226_IMUsed: 84 case Palantir_HttpStatus_226_IMUsed:
85 return "IM Used"; 85 return "IM Used";
86 86
87 case HttpStatus_300_MultipleChoices: 87 case Palantir_HttpStatus_300_MultipleChoices:
88 return "Multiple Choices"; 88 return "Multiple Choices";
89 89
90 case HttpStatus_301_MovedPermanently: 90 case Palantir_HttpStatus_301_MovedPermanently:
91 return "Moved Permanently"; 91 return "Moved Permanently";
92 92
93 case HttpStatus_302_Found: 93 case Palantir_HttpStatus_302_Found:
94 return "Found"; 94 return "Found";
95 95
96 case HttpStatus_303_SeeOther: 96 case Palantir_HttpStatus_303_SeeOther:
97 return "See Other"; 97 return "See Other";
98 98
99 case HttpStatus_304_NotModified: 99 case Palantir_HttpStatus_304_NotModified:
100 return "Not Modified"; 100 return "Not Modified";
101 101
102 case HttpStatus_305_UseProxy: 102 case Palantir_HttpStatus_305_UseProxy:
103 return "Use Proxy"; 103 return "Use Proxy";
104 104
105 case HttpStatus_307_TemporaryRedirect: 105 case Palantir_HttpStatus_307_TemporaryRedirect:
106 return "Temporary Redirect"; 106 return "Temporary Redirect";
107 107
108 case HttpStatus_400_BadRequest: 108 case Palantir_HttpStatus_400_BadRequest:
109 return "Bad Request"; 109 return "Bad Request";
110 110
111 case HttpStatus_401_Unauthorized: 111 case Palantir_HttpStatus_401_Unauthorized:
112 return "Unauthorized"; 112 return "Unauthorized";
113 113
114 case HttpStatus_402_PaymentRequired: 114 case Palantir_HttpStatus_402_PaymentRequired:
115 return "Payment Required"; 115 return "Payment Required";
116 116
117 case HttpStatus_403_Forbidden: 117 case Palantir_HttpStatus_403_Forbidden:
118 return "Forbidden"; 118 return "Forbidden";
119 119
120 case HttpStatus_404_NotFound: 120 case Palantir_HttpStatus_404_NotFound:
121 return "Not Found"; 121 return "Not Found";
122 122
123 case HttpStatus_405_MethodNotAllowed: 123 case Palantir_HttpStatus_405_MethodNotAllowed:
124 return "Method Not Allowed"; 124 return "Method Not Allowed";
125 125
126 case HttpStatus_406_NotAcceptable: 126 case Palantir_HttpStatus_406_NotAcceptable:
127 return "Not Acceptable"; 127 return "Not Acceptable";
128 128
129 case HttpStatus_407_ProxyAuthenticationRequired: 129 case Palantir_HttpStatus_407_ProxyAuthenticationRequired:
130 return "Proxy Authentication Required"; 130 return "Proxy Authentication Required";
131 131
132 case HttpStatus_408_RequestTimeout: 132 case Palantir_HttpStatus_408_RequestTimeout:
133 return "Request Timeout"; 133 return "Request Timeout";
134 134
135 case HttpStatus_409_Conflict: 135 case Palantir_HttpStatus_409_Conflict:
136 return "Conflict"; 136 return "Conflict";
137 137
138 case HttpStatus_410_Gone: 138 case Palantir_HttpStatus_410_Gone:
139 return "Gone"; 139 return "Gone";
140 140
141 case HttpStatus_411_LengthRequired: 141 case Palantir_HttpStatus_411_LengthRequired:
142 return "Length Required"; 142 return "Length Required";
143 143
144 case HttpStatus_412_PreconditionFailed: 144 case Palantir_HttpStatus_412_PreconditionFailed:
145 return "Precondition Failed"; 145 return "Precondition Failed";
146 146
147 case HttpStatus_413_RequestEntityTooLarge: 147 case Palantir_HttpStatus_413_RequestEntityTooLarge:
148 return "Request Entity Too Large"; 148 return "Request Entity Too Large";
149 149
150 case HttpStatus_414_RequestUriTooLong: 150 case Palantir_HttpStatus_414_RequestUriTooLong:
151 return "Request-URI Too Long"; 151 return "Request-URI Too Long";
152 152
153 case HttpStatus_415_UnsupportedMediaType: 153 case Palantir_HttpStatus_415_UnsupportedMediaType:
154 return "Unsupported Media Type"; 154 return "Unsupported Media Type";
155 155
156 case HttpStatus_416_RequestedRangeNotSatisfiable: 156 case Palantir_HttpStatus_416_RequestedRangeNotSatisfiable:
157 return "Requested Range Not Satisfiable"; 157 return "Requested Range Not Satisfiable";
158 158
159 case HttpStatus_417_ExpectationFailed: 159 case Palantir_HttpStatus_417_ExpectationFailed:
160 return "Expectation Failed"; 160 return "Expectation Failed";
161 161
162 case HttpStatus_422_UnprocessableEntity: 162 case Palantir_HttpStatus_422_UnprocessableEntity:
163 return "Unprocessable Entity"; 163 return "Unprocessable Entity";
164 164
165 case HttpStatus_423_Locked: 165 case Palantir_HttpStatus_423_Locked:
166 return "Locked"; 166 return "Locked";
167 167
168 case HttpStatus_424_FailedDependency: 168 case Palantir_HttpStatus_424_FailedDependency:
169 return "Failed Dependency"; 169 return "Failed Dependency";
170 170
171 case HttpStatus_426_UpgradeRequired: 171 case Palantir_HttpStatus_426_UpgradeRequired:
172 return "Upgrade Required"; 172 return "Upgrade Required";
173 173
174 case HttpStatus_500_InternalServerError: 174 case Palantir_HttpStatus_500_InternalServerError:
175 return "Internal Server Error"; 175 return "Internal Server Error";
176 176
177 case HttpStatus_501_NotImplemented: 177 case Palantir_HttpStatus_501_NotImplemented:
178 return "Not Implemented"; 178 return "Not Implemented";
179 179
180 case HttpStatus_502_BadGateway: 180 case Palantir_HttpStatus_502_BadGateway:
181 return "Bad Gateway"; 181 return "Bad Gateway";
182 182
183 case HttpStatus_503_ServiceUnavailable: 183 case Palantir_HttpStatus_503_ServiceUnavailable:
184 return "Service Unavailable"; 184 return "Service Unavailable";
185 185
186 case HttpStatus_504_GatewayTimeout: 186 case Palantir_HttpStatus_504_GatewayTimeout:
187 return "Gateway Timeout"; 187 return "Gateway Timeout";
188 188
189 case HttpStatus_505_HttpVersionNotSupported: 189 case Palantir_HttpStatus_505_HttpVersionNotSupported:
190 return "HTTP Version Not Supported"; 190 return "HTTP Version Not Supported";
191 191
192 case HttpStatus_506_VariantAlsoNegotiates: 192 case Palantir_HttpStatus_506_VariantAlsoNegotiates:
193 return "Variant Also Negotiates"; 193 return "Variant Also Negotiates";
194 194
195 case HttpStatus_507_InsufficientStorage: 195 case Palantir_HttpStatus_507_InsufficientStorage:
196 return "Insufficient Storage"; 196 return "Insufficient Storage";
197 197
198 case HttpStatus_509_BandwidthLimitExceeded: 198 case Palantir_HttpStatus_509_BandwidthLimitExceeded:
199 return "Bandwidth Limit Exceeded"; 199 return "Bandwidth Limit Exceeded";
200 200
201 case HttpStatus_510_NotExtended: 201 case Palantir_HttpStatus_510_NotExtended:
202 return "Not Extended"; 202 return "Not Extended";
203 203
204 default: 204 default:
205 throw HttpException("Unknown HTTP status"); 205 throw HttpException("Unknown HTTP status");
206 } 206 }