Commit ff44640
committed
refactor!: unify the HTTP error path on a single exception base and a Retryable interface
The response-carrying exception hierarchy had two overlapping bases and the
factory that produces the typed family was never wired into the error path.
- Collapse `HttpResponseException` (an `IOException` carrying a `Response` +
optional error value) into `HttpException`. `HttpException` becomes the single
response-carrying base; it gains an optional `value` slot for a deserialized
error payload so the generated layer can stamp a typed body later. Transport
failures keep using the `NetworkException` (`IOException`) sibling, so existing
`catch (IOException)` sites for transport errors are unaffected.
- Introduce a `Retryable` interface (`val isRetryable: Boolean`) and implement it
on both `HttpException` and `NetworkException`. The two types previously
disagreed on the accessor name (`retryable` vs `isRetryable`); they now expose
the same member through the interface. Retry classification in `RetryStep` keys
off `Retryable` instead of matching concrete types, so a new retryable exception
type participates automatically. The set of retryable statuses is unchanged
(408/429 and 5xx except 501/505, still derived from `RetryUtils`).
- Wire `HttpExceptionFactory.fromResponse` into the live error path via a new
`ThrowOnHttpErrorStep` response step: on a 4xx/5xx response it throws the
factory's typed exception, which `ResponsePipeline` turns into a failure outcome
that flows through the recovery chain (including retry) like a transport failure.
Previously the factory had no callers and 4xx/5xx responses never produced the
typed subclass family.
This is a binary-incompatible change to the public exception API: the
`HttpResponseException` type is removed, the `retryable` getter on `HttpException`
and `NetworkException` is renamed to `isRetryable`, and `HttpException` gains a
`value` property and a corresponding constructor parameter. API snapshot
regenerated; docs updated.1 parent ea0cc81 commit ff44640
17 files changed
Lines changed: 415 additions & 324 deletions
File tree
- docs
- sdk-core
- api
- src
- main/kotlin/org/dexpace/sdk/core
- http/response
- exception
- pipeline/step
- retry
- util
- test/kotlin/org/dexpace/sdk/core
- http/response
- exception
- pipeline/step
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
250 | | - | |
| 249 | + | |
| 250 | + | |
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
575 | 575 | | |
576 | 576 | | |
577 | 577 | | |
578 | | - | |
579 | | - | |
| 578 | + | |
| 579 | + | |
580 | 580 | | |
581 | 581 | | |
582 | 582 | | |
| |||
653 | 653 | | |
654 | 654 | | |
655 | 655 | | |
656 | | - | |
657 | | - | |
| 656 | + | |
| 657 | + | |
658 | 658 | | |
659 | 659 | | |
660 | 660 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
289 | | - | |
290 | | - | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
291 | 292 | | |
292 | 293 | | |
293 | 294 | | |
| |||
302 | 303 | | |
303 | 304 | | |
304 | 305 | | |
305 | | - | |
306 | | - | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
307 | 309 | | |
308 | 310 | | |
309 | 311 | | |
310 | 312 | | |
311 | | - | |
| 313 | + | |
312 | 314 | | |
313 | 315 | | |
314 | | - | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
315 | 321 | | |
316 | 322 | | |
317 | 323 | | |
| |||
355 | 361 | | |
356 | 362 | | |
357 | 363 | | |
358 | | - | |
359 | | - | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
360 | 367 | | |
361 | 368 | | |
362 | 369 | | |
363 | | - | |
| 370 | + | |
364 | 371 | | |
365 | 372 | | |
366 | 373 | | |
367 | 374 | | |
368 | 375 | | |
369 | | - | |
370 | | - | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
371 | 379 | | |
372 | 380 | | |
373 | 381 | | |
| |||
379 | 387 | | |
380 | 388 | | |
381 | 389 | | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
382 | 396 | | |
383 | 397 | | |
384 | 398 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
358 | | - | |
| 358 | + | |
| 359 | + | |
359 | 360 | | |
360 | | - | |
| 361 | + | |
361 | 362 | | |
362 | | - | |
| 363 | + | |
| 364 | + | |
363 | 365 | | |
364 | 366 | | |
365 | 367 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
| 226 | + | |
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1100 | 1100 | | |
1101 | 1101 | | |
1102 | 1102 | | |
1103 | | - | |
1104 | | - | |
1105 | | - | |
1106 | | - | |
1107 | | - | |
1108 | | - | |
1109 | | - | |
1110 | | - | |
1111 | | - | |
1112 | | - | |
1113 | 1103 | | |
1114 | 1104 | | |
1115 | 1105 | | |
| |||
1319 | 1309 | | |
1320 | 1310 | | |
1321 | 1311 | | |
1322 | | - | |
| 1312 | + | |
1323 | 1313 | | |
1324 | 1314 | | |
1325 | 1315 | | |
1326 | 1316 | | |
1327 | 1317 | | |
1328 | | - | |
| 1318 | + | |
| 1319 | + | |
1329 | 1320 | | |
1330 | 1321 | | |
1331 | 1322 | | |
1332 | 1323 | | |
1333 | 1324 | | |
1334 | | - | |
1335 | 1325 | | |
| 1326 | + | |
| 1327 | + | |
1336 | 1328 | | |
1337 | 1329 | | |
1338 | 1330 | | |
| |||
1357 | 1349 | | |
1358 | 1350 | | |
1359 | 1351 | | |
1360 | | - | |
| 1352 | + | |
1361 | 1353 | | |
1362 | 1354 | | |
1363 | 1355 | | |
1364 | 1356 | | |
1365 | | - | |
| 1357 | + | |
1366 | 1358 | | |
1367 | 1359 | | |
1368 | 1360 | | |
| |||
1386 | 1378 | | |
1387 | 1379 | | |
1388 | 1380 | | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
1389 | 1385 | | |
1390 | 1386 | | |
1391 | 1387 | | |
| |||
2091 | 2087 | | |
2092 | 2088 | | |
2093 | 2089 | | |
| 2090 | + | |
| 2091 | + | |
| 2092 | + | |
| 2093 | + | |
| 2094 | + | |
| 2095 | + | |
2094 | 2096 | | |
2095 | 2097 | | |
2096 | 2098 | | |
| |||
Lines changed: 0 additions & 60 deletions
This file was deleted.
0 commit comments