aws-amplify / amplify-swift

A declarative library for application development using cloud services.
Apache License 2.0
456 stars 198 forks source link

fix(analytics): iterate sqlite rows with failableNext #3857

Closed 5d closed 2 months ago

5d commented 2 months ago

Issue \

https://github.com/aws-amplify/amplify-swift/issues/3855

Description

The default iteration behavior for SQLite statement results uses try!, which throws a runtime error that can't be caught by Swift's standard do..try mechanism. Since the analytics category runs as a background monitoring thread, it shouldn't cause the app to enter an error state. Instead, use the alternative throwable API failableNext to avoid runtime errors.

General Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 68.44%. Comparing base (4782923) to head (6e3889e). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #3857 +/- ## ========================================== + Coverage 68.40% 68.44% +0.04% ========================================== Files 1082 1082 Lines 37699 37699 ========================================== + Hits 25787 25804 +17 + Misses 11912 11895 -17 ``` | [Flag](https://app.codecov.io/gh/aws-amplify/amplify-swift/pull/3857/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws-amplify) | Coverage Δ | | |---|---|---| | [API_plugin_unit_test](https://app.codecov.io/gh/aws-amplify/amplify-swift/pull/3857/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws-amplify) | `69.35% <ø> (+0.03%)` | :arrow_up: | | [AWSPluginsCore](https://app.codecov.io/gh/aws-amplify/amplify-swift/pull/3857/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws-amplify) | `68.53% <ø> (ø)` | | | [Amplify](https://app.codecov.io/gh/aws-amplify/amplify-swift/pull/3857/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws-amplify) | `47.57% <ø> (+0.01%)` | :arrow_up: | | [Analytics_plugin_unit_test](https://app.codecov.io/gh/aws-amplify/amplify-swift/pull/3857/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws-amplify) | `84.52% <ø> (ø)` | | | [Auth_plugin_unit_test](https://app.codecov.io/gh/aws-amplify/amplify-swift/pull/3857/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws-amplify) | `79.52% <ø> (+0.18%)` | :arrow_up: | | [DataStore_plugin_unit_test](https://app.codecov.io/gh/aws-amplify/amplify-swift/pull/3857/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws-amplify) | `81.23% <ø> (-0.06%)` | :arrow_down: | | [Geo_plugin_unit_test](https://app.codecov.io/gh/aws-amplify/amplify-swift/pull/3857/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws-amplify) | `72.00% <ø> (ø)` | | | [Logging_plugin_unit_test](https://app.codecov.io/gh/aws-amplify/amplify-swift/pull/3857/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws-amplify) | `62.95% <ø> (ø)` | | | [Predictions_plugin_unit_test](https://app.codecov.io/gh/aws-amplify/amplify-swift/pull/3857/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws-amplify) | `36.86% <ø> (ø)` | | | [PushNotifications_plugin_unit_test](https://app.codecov.io/gh/aws-amplify/amplify-swift/pull/3857/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws-amplify) | `86.21% <ø> (ø)` | | | [Storage_plugin_unit_test](https://app.codecov.io/gh/aws-amplify/amplify-swift/pull/3857/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws-amplify) | `76.81% <ø> (ø)` | | | [unit_tests](https://app.codecov.io/gh/aws-amplify/amplify-swift/pull/3857/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws-amplify) | `68.44% <ø> (+0.04%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws-amplify#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.