Acknowledged

bug: System Error when calling Session.start()

I see a few errors like:

Error Name: System Error
Devices:
    Forerunner® 965: 19.18
    Forerunner® 245: 13.70
Backtrace:
    MyView.startTimer:184

code:

MyView {
 function startTimer() as Void {
  session.start();
 }
}

However I don't understand what can cause System Error. I mean according to the documentation there's no mention of any condition that start is not supposed to be called, and I would expect it never to fail (but maybe return false):

------------------------- 8< --------------------------------------

start() as Lang.Boolean

Begin recording a FIT file on the system.

Returns:

  • Lang.Boolean  

    true if recording was successfully started, otherwise false

Since:

API Level 1.0.0

------------------------ >8 ----------------------------------------

I suspect that what happens is the user saves the session (calls session.save()), and then accidentally clicks the start button, and my code tries to start the session again.

It would be nice to have something about this in the documentation (and maybe there could be a better name for the error), together with the recommended way to avoid this (I mean I can add some booleans to my code and keep track of things, but is it necessary? Maybe there could be another function, similar to session.isRecording? Or is it isRecording() I should call: if (!session.isRecording()) {session.start();}

Parents
  • I don't see how the user pressing a button by "accident" comes into play here.

    To be clear, I”m not saying that the user is incapable of making a mistake, but only that any mistake the app allows should also correspond to a deliberate action.

    For example, I can lap my activity by accident by pressing the lap button, but I could’ve also taken a lap on purpose.

    If such an action has serious consequences for the user, that’s where it would help if the app allows the user to undo the action (e.g. in the case of taking or lap) or asks for confirmation (e.g. in the case of saving or discarding an activity).

    Otoh, if it’s possible in principle for the user to “accidentally” trigger code that shouldn’t even run in principle, that’s where I think an app should constrain the user so they can’t take that action. For example, a native activity won’t let you take a lap before the timer has started. The user is constrained to only be able to take laps while the timer is running (with the lap button) or while the timer is stopped (via the menu).

Comment
  • I don't see how the user pressing a button by "accident" comes into play here.

    To be clear, I”m not saying that the user is incapable of making a mistake, but only that any mistake the app allows should also correspond to a deliberate action.

    For example, I can lap my activity by accident by pressing the lap button, but I could’ve also taken a lap on purpose.

    If such an action has serious consequences for the user, that’s where it would help if the app allows the user to undo the action (e.g. in the case of taking or lap) or asks for confirmation (e.g. in the case of saving or discarding an activity).

    Otoh, if it’s possible in principle for the user to “accidentally” trigger code that shouldn’t even run in principle, that’s where I think an app should constrain the user so they can’t take that action. For example, a native activity won’t let you take a lap before the timer has started. The user is constrained to only be able to take laps while the timer is running (with the lap button) or while the timer is stopped (via the menu).

Children
No Data