Commit abc67a1
committed
improved error handling:
provides both machine-readable error classification and human-readable detailed messages
1. Error Kind Constants (in types.rs)
Added 11 error type constants that map to LabVIEW enums:
- ERROR_KIND_NONE through ERROR_KIND_UNKNOWN
2. Enhanced Response Structure (in types.rs)
Added three new fields to track error details:
- error_kind: The type of error (timeout, connection, etc.)
- error_url: The URL associated with the error
- error_source: The root cause from the error chain
3. Error Analysis Function (in async_support.rs)
Created analyze_reqwest_error() that:
- Classifies errors using reqwest's is_*() methods
- Extracts the URL if available
- Gets the root cause via source()
- Builds a detailed error message with the full error chain
4. New FFI Functions (in ffi/request.rs)
- request_get_error_kind() - Returns the error type constant
- request_get_error_message() - Returns the detailed error message
- request_get_error_url() - Returns the URL if available
- request_get_error_source() - Returns the root cause
- request_response_has_error() - Checks if there's any error
5. Exports Updated (in lib.rs)
All new functions are exported for use by LabVIEW
Now when you get a timeout error, you'll be able to:
1. Call request_get_error_kind() and get ERROR_KIND_TIMEOUT (value 1)
2. Call request_get_error_message() to get a detailed message including the root cause
3. Call request_get_error_url() to see which URL failed
4. Call request_get_error_source() to get just the underlying error cause1 parent 80b8494 commit abc67a1
4 files changed
+205
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
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 | + | |
10 | 47 | | |
11 | 48 | | |
12 | 49 | | |
| |||
56 | 93 | | |
57 | 94 | | |
58 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
59 | 99 | | |
60 | 100 | | |
61 | 101 | | |
| |||
74 | 114 | | |
75 | 115 | | |
76 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
77 | 120 | | |
78 | 121 | | |
79 | 122 | | |
| |||
88 | 131 | | |
89 | 132 | | |
90 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
91 | 137 | | |
92 | 138 | | |
93 | 139 | | |
| |||
99 | 145 | | |
100 | 146 | | |
101 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
102 | 151 | | |
103 | 152 | | |
104 | 153 | | |
| |||
119 | 168 | | |
120 | 169 | | |
121 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
122 | 174 | | |
123 | 175 | | |
124 | 176 | | |
| |||
130 | 182 | | |
131 | 183 | | |
132 | 184 | | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
133 | 188 | | |
134 | 189 | | |
135 | 190 | | |
136 | 191 | | |
137 | 192 | | |
138 | 193 | | |
139 | 194 | | |
| 195 | + | |
| 196 | + | |
140 | 197 | | |
141 | 198 | | |
142 | 199 | | |
143 | | - | |
| 200 | + | |
144 | 201 | | |
145 | 202 | | |
146 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
147 | 207 | | |
148 | 208 | | |
149 | 209 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
74 | 77 | | |
75 | 78 | | |
76 | 79 | | |
| |||
93 | 96 | | |
94 | 97 | | |
95 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
0 commit comments