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
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import com.google.android.fhir.NetworkConfiguration
import com.google.android.fhir.ServerConfiguration
import com.google.android.fhir.datacapture.DataCaptureConfig
import com.google.android.fhir.datacapture.XFhirQueryResolver
import com.google.android.fhir.db.ResourceNotFoundException
import com.google.android.fhir.search.search
import com.google.android.fhir.sync.remote.HttpLogger
import timber.log.Timber
Expand Down Expand Up @@ -63,7 +64,14 @@ class FhirApplication : Application(), DataCaptureConfig.Provider {
dataCaptureConfig =
DataCaptureConfig().apply {
urlResolver = ReferenceUrlResolver(this@FhirApplication as Context)
xFhirQueryResolver = XFhirQueryResolver { fhirEngine.search(it).map { it.resource } }
xFhirQueryResolver = XFhirQueryResolver {
try {
fhirEngine.search(it).map { it.resource }
} catch (e: ResourceNotFoundException) {
Timber.e(e)
emptyList()
}
}
}
}

Expand Down
Loading