pachli-android/core/network
Nik Clayton 5aacb02ea0
feat: Provide more detail in errors, especially media upload errors (#801)
Previous code assumed server responses would always be JSON, and had no
special handling for mis-configured servers that sometimes return HTML;
for example, if the server has a bug, or there's a reverse proxy in
front of the server issuing DoS-prevention challenges.

This could cause errors to show with no useful debugging information.

Update `ApiResult` to check the content-type in the response and return
one of two new errors if the content-type is missing or wrong. Also
include the HTTP code in `ApiResponse` for use elsewhere.

Update `ThrowableExtensions` to pull the `error` and optional
`description` out of the error body.

Update `PachliError` so `formatArgs` can be an array of arbitrary types,
not just strings.

Update `MediaUploader`; expose the different errors as new
`MediaUploaderError` types instead of `Exception` subclasses, and return
`Result<V, E>` where appropriate.

Update `ComposeViewModel` to use the new `MediaUploaderError` types and
create new `PickMediaError` to report issues there, replacing
`VideoOrImageException`.

Update `ComposeActivity` to use the new error types and show errors
until the user dismisses them, so they're better able to see and report
problems.

Fixes #704.
2024-07-04 19:16:24 +02:00
..
src feat: Provide more detail in errors, especially media upload errors (#801) 2024-07-04 19:16:24 +02:00
build.gradle.kts feat: Provide more detail in errors, especially media upload errors (#801) 2024-07-04 19:16:24 +02:00
lint-baseline.xml refactor: Use the PachliError type for ApiError (#739) 2024-06-12 10:22:27 +02:00
proguard-rules.pro refactor: Start creating core modules (#286) 2023-12-04 16:58:36 +01:00