Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed demo app crash by appropriately handing ResourceNotFoundException. #2152

Merged
merged 6 commits into from
Sep 7, 2023

Conversation

aditya-07
Copy link
Collaborator

@aditya-07 aditya-07 commented Sep 1, 2023

IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).

Fixes #[issue number]

** ISSUE Description**
Moving to the Temperature Page during the Survey for a patient is causing the app to crash with the following error:
E FATAL EXCEPTION: main Process: com.google.android.fhir.demo, PID: 6320 com.google.android.fhir.db.ResourceNotFoundException: Resource not found with type Binary and id android-fhir-thermometer-image! at com.google.android.fhir.db.impl.DatabaseImpl$select$2.invokeSuspend(DatabaseImpl.kt:160) at com.google.android.fhir.db.impl.DatabaseImpl$select$2.invoke(Unknown Source:8) at com.google.android.fhir.db.impl.DatabaseImpl$select$2.invoke(Unknown Source:2) at androidx.room.RoomDatabaseKt$withTransaction$transactionBlock$1.invokeSuspend(RoomDatabaseExt.kt:56) at androidx.room.RoomDatabaseKt$withTransaction$transactionBlock$1.invoke(Unknown Source:8) at androidx.room.RoomDatabaseKt$withTransaction$transactionBlock$1.invoke(Unknown Source:4) at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:78) at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:167) at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1) at androidx.room.RoomDatabaseKt$startTransactionCoroutine$2$1$1.invokeSuspend(RoomDatabaseExt.kt:97) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108) at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:280) at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85) at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59) at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source:1) at androidx.room.RoomDatabaseKt$startTransactionCoroutine$2$1.run(RoomDatabaseExt.kt:93) at androidx.room.TransactionExecutor.execute$lambda$1$lambda$0(TransactionExecutor.kt:36) at androidx.room.TransactionExecutor.$r8$lambda$AympDHYBb78s7_N_9gRsXF0sHiw(Unknown Source:0) at androidx.room.TransactionExecutor$$ExternalSyntheticLambda0.run(Unknown Source:4) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:923) Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException:

** Description**

Wrapped the calls to FhirEngine search in try/catch block to handle ResourceNotFoundException appropriately.

Alternative(s) considered
Have you considered any alternatives? And if so, why have you chosen the approach in this PR?

Type
Choose one: Bug fix

Screenshots (if applicable)

Checklist

  • I have read and acknowledged the Code of conduct.
  • I have read the Contributing page.
  • I have signed the Google Individual CLA, or I am covered by my company's Corporate CLA.
  • I have discussed my proposed solution with code owners in the linked issue(s) and we have agreed upon the general approach.
  • I have run ./gradlew spotlessApply and ./gradlew spotlessCheck to check my code follows the style guide of this project.
  • I have run ./gradlew check and ./gradlew connectedCheck to test my changes locally.
  • I have built and run the demo app(s) to verify my change fixes the issue and/or does not break the demo app(s).

@santosh-pingle
Copy link
Collaborator

@aditya-07
Can you please link the issue?

@aditya-07 aditya-07 merged commit 9b1cb4f into google:master Sep 7, 2023
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

None yet

4 participants