ERA Viewer: Unhandled Exception in decrement (--) operation

Hi,

I’m seeing another exception in the ERA Viewer that I’m having trouble explaining.

Error Name: Unhandled Exception
Occurrences: 2
First Occurrence: 2026-01-01
Last Occurrence: 2026-01-02
Devices:
    Venu® X1: 15.33
    Forerunner® 970: 15.33
App Versions: v1.1.2.1
Languages: deu
Backtrace:
    ViewHandler.popView:29
    PageMenuDelegate.onBack:43

The exception seems to occur at the decrement (--) operation in the following code:

private static var _stackSize as Number = 0;

public static function popView( transition as SlideType ) as Void {
    if( _stackSize < 1 ) {
        throw new GeneralException( "ViewHandler.popView called on zero view stack size" );
    }
    _stackSize--;
    WatchUi.popView( transition );
}

Do you have any idea what could trigger an exception at _stackSize-- in this context?
Is it possible that the ERA report is misleading here? I double-checked that the backtrace matches the v1.1.2.1 code.

Source file:

github.com/.../ViewHandler.mc

  • As the ERA was out of action for so long I made myself a web service that took exception text and version numbers and popped them in a table storage (online cloud services pretty much allow this on a free tier as transactions and storage are low), … then my try/catch call an Exception handler than makes the comm request and then I can review exceptions via a simple web page or table browser. Found things I was not expecting at all such as onLayout throwing memory errors at setLayout time that meant I had no layout items (I know there are other ways there, just was not expecting that and having more flagged to me directly has improved overall code and user experience)

  • Interesting, and lucky that after not having enough memory in onLayout you had enough memory to send a web request.

  • Yeah. You can use instanceof as a workaround if you know the exception types that can be caught. Not ideal, but works:

    try {
    var myProblem = ["1", 1];
    myProblem.sort(null);
    } catch (e) {
    var type = "Unknown";
    if (e instanceof SymbolNotAllowedException) {type = "SymbolNotAllowedException";}
    else if (e instanceof ValueOutOfBoundsException) {type = "ValueOutOfBoundsException";}
    else if (e instanceof UnexpectedTypeException) {type = "UnexpectedTypeException";}
    System.println("Found error: " + type + ": " + e.getErrorMessage());
    }

    Run it on fr955 and you'll see what you expect. It also demonstrates an ever bigger problem than not knowing the exception type: There are not only exceptions but also uncatchable errors. If you run it on fr245 you'll not be able to catch it (Array.sort is only from CIQ 5.0.0)