Repository navigation
When a sync fails, the app doesn't say why #85
Description
Describe the bug
When a sync fails, the app shows "Sync failed. Please try again." regardless of the cause. It keeps no details it could show or log, so a wrong base URL, a refused token, and a server error all look the same.
Component
Reference app, sync
To Reproduce
Steps to reproduce the behaviour:
- Set up
local.propertiesso the desktop app can sign in to the reference environment, and setFHIR_BASE_URL=http://localhost:8083/fhir, without the trailing slash. - Run
./gradlew :reference-app:run, sign in and choose Sync now. - The app shows "Sync failed. Please try again." The requests return 404, but nothing on screen or in the app's state says so.
Expected behavior
The app shows a short reason, such as the HTTP status and resource type, and logs the details.
Screenshots
None.
Smartphone (please complete the following information):
Not applicable. Seen on the desktop target on macOS 27.0
Additional context
ForegroundSyncManager.kt lines 30 to 40 waits for the engine's terminal status and turns any failure into an empty SyncJobStatus.Failed(). HomeViewModel.kt lines 71 to 86 does the same with exceptions and shows a fixed message from strings.xml.
The other platforms lose the cause too. Android's WorkManagerSyncManager.kt lines 35 to 46 does the same as ForegroundSyncManager. On iOS, IosSyncManager.kt lines 125 to 127 logs the exception, then returns an empty Failed(). HomeViewModel shows the same message on every platform.
The engine's SyncJobStatus.Failed can carry the exceptions, but the terminal CurrentSyncJobStatus.Failed that ForegroundSyncManager waits for carries only a timestamp (SyncJobStatus.kt lines 84 and 121 to 123 at v2.0.0-alpha04).
Suggested fix: keep the cause of a failed sync; for example, from the engine's Running updates, show a short reason and log the details. ohs-foundation/kotlin-fhir-engine#91 reports that the engine drops the exception type and cause. It does not cover the final failed status, which carries no exception.
Open pull request #77 moves these files to ohs-player-library/ without changing them. If #77 merges first, the fix goes there.
This made the trailing-slash bug, #84, hard to find.
Would you like to work on the issue?
No. This was found while testing the OHS documentation.
Activity