mirror of
https://github.com/pachli/pachli-android.git
synced 2025-01-24 14:11:56 +01:00
5aacb02ea0
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. |
||
---|---|---|
.. | ||
src | ||
build.gradle.kts | ||
lint-baseline.xml |