File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -141,4 +141,32 @@ datastreams[2].setString("Pretty comfy temperature"); // Push a String datapoi
141
141
datastreams[3 ].setBuffer(" But quite dry" ); // Push a char buffer datapoint
142
142
```
143
143
144
+ ##Error codes
145
+
146
+ This library uses [ _ amcewen/HttpClient_ ] ( https://github.com/amcewen/HttpClient/blob/master/HttpClient.h ) which has following error codes:
147
+
148
+ * ` HTTP_SUCCESS = 0 ` - no error
149
+ * ` HTTP_ERROR_CONNECTION_FAILED = -1 ` - connection to _ api.xively.com_ has failed
150
+ * ` HTTP_ERROR_API = -2 ` - a method of _ HttpClient_ class was called incorrectly
151
+ * ` HTTP_ERROR_TIMED_OUT = -3 ` - connection with _ api.xively.com_ has timed-out
152
+ * ` HTTP_ERROR_INVALID_RESPONSE = -4 ` - invalid or unexpected response from the server
153
+
154
+ Apart from the above, the library will convert any _ non-2xx_ status code to a nagative value like so:
155
+ ``` c
156
+ ret = http.responseStatusCode();
157
+ if ((ret < 200 ) || (ret > 299 ))
158
+ {
159
+
160
+ if (ret > 0)
161
+ {
162
+ ret = ret * -1;
163
+ }
164
+ }
165
+ ```
166
+
167
+ Therefore:
168
+ * if we got a _ 2xx_ , we will return that as is
169
+ * if we got a negative value (e.g. ` HTTP_ERROR_CONNECTION_FAILED ` , ` HTTP_ERROR_TIMED_OUT ` or other), we will return that as is
170
+ * any _ non-2xx_ status code is returned multiplied by _ -1_ , i.e. a _ 403 (Authentication error)_ will be returned as _ -403_
171
+
144
172
[ ![ githalytics.com alpha] ( https://cruel-carlota.pagodabox.com/fa828feced5044961a2e1b6481ed83a9 " githalytics.com ")] ( http://githalytics.com/xively/xively-arduino )
You can’t perform that action at this time.
0 commit comments