Please complete the following information for each phone and/or emulator you're experiencing this bug on:
Device: Pixel 7 Pro API 34 Emulator
OS: Android 14
Describe the bug
Error handling practically doesn't exist. If the native part of this plugin throws an error, the app just crashes with no way of salvaging the situation in Dart code.
The code example is just one issue, another one is the api rate limit discussed in #787. Hitting the api limit just crashes the app, which makes retrying later MUCH harder than it needs to be.
This should throw a Dart Exception because start date has to be earlier than the end date.
Actual behavior
App crashes.
E/AndroidRuntime(23563): FATAL EXCEPTION: main
E/AndroidRuntime(23563): Process: redacted, PID: 23563
E/AndroidRuntime(23563): java.lang.IllegalArgumentException: end time needs be after start time
E/AndroidRuntime(23563): at androidx.health.connect.client.time.TimeRangeFilter$Companion.between(TimeRangeFilter.kt:61)
E/AndroidRuntime(23563): at cachet.plugins.health.HealthPlugin$getHCData$1.invokeSuspend(HealthPlugin.kt:2623)
E/AndroidRuntime(23563): at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
E/AndroidRuntime(23563): at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
E/AndroidRuntime(23563): at android.os.Handler.handleCallback(Handler.java:958)
E/AndroidRuntime(23563): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(23563): at android.os.Looper.loopOnce(Looper.java:205)
E/AndroidRuntime(23563): at android.os.Looper.loop(Looper.java:294)
E/AndroidRuntime(23563): at android.app.ActivityThread.main(ActivityThread.java:8177)
E/AndroidRuntime(23563): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(23563): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
E/AndroidRuntime(23563): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
E/AndroidRuntime(23563): Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@d690e6b, Dispatchers.Main]
I/Process (23563): Sending signal. PID: 23563 SIG: 9
Lost connection to device.
Exited.
Screenshots
N/A
Flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.1, on macOS 14.4.1 23E224 darwin-arm64, locale de-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.2)
[✓] VS Code (version 1.87.2)
[✓] Connected device (2 available)
[✓] Network resources
Device / Emulator and OS
Please complete the following information for each phone and/or emulator you're experiencing this bug on:
Describe the bug
Error handling practically doesn't exist. If the native part of this plugin throws an error, the app just crashes with no way of salvaging the situation in Dart code.
To Reproduce
Expected behavior
This should throw a Dart Exception because start date has to be earlier than the end date.
Actual behavior
App crashes.
Screenshots
N/A
Flutter doctor
Additional information
Add any other info about the problem here.