Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-23621

Windows: Improve error message when passing an invalid number of arguments to a function

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: None
    • Resolution: Fixed
    • Affects Version/s: Release 5.4.0
    • Fix Version/s: Release 6.1.0
    • Component/s: Windows
    • Labels:
    • Environment:

      Windows 10 Pro
      Ti SDK: 5.4.0.v20160705213725
      Appc NPM: 4.2.8-1
      Appc CLI: 5.4.0-29

    • Story Points:
      5
    • Sprint:
      2016 Sprint 18 SDK

      Description

      Description

      When calling a function that has a minimum required number of args, in the example provided I use the appendRow method with only 1 argument, the error below is printed out

      [ERROR] :  Application Error: {
      [ERROR] :    "line": 2,
      [ERROR] :    "column": 10,
      [ERROR] :    "message": "Error while require(/app) invalid vector<T> subscript",
      [ERROR] :    "native_stack": [
      [ERROR] :      "JSExportClass<class Titanium::GlobalObject>::CallNamedFunction"
      [ERROR] :    ]
      [ERROR] :  }
      

      However when building for Android the following error is thrown, which explains the reason for the error

      [ERROR] :  TiExceptionHandler: (main) [70,70] ----- Titanium Javascript Runtime Error -----
      [ERROR] :  TiExceptionHandler: (main) [0,70] - In app.js:7,7
      [ERROR] :  TiExceptionHandler: (main) [0,70] - Message: Uncaught Error: insertRowAfter: Invalid number of arguments. Expected 2 but got 1
      [ERROR] :  TiExceptionHandler: (main) [1,71] - Source: table.insertRowAfter(Ti.UI.createTableViewRow({ title: 'notEnoughArgs' }));
      [ERROR] :  V8Exception: Exception occurred at app.js:7: Uncaught Error: insertRowAfter: Invalid number of arguments. Expected 2 but got 1
      

      Demo code

      var win = Ti.UI.createWindow();
      Ti.UI.createTableViewRow({ title: 'Bananas' });
      var table = Ti.UI.createTableView({});
      table.insertRowAfter(Ti.UI.createTableViewRow({ title: 'notEnoughArgs' }));
      win.add(table);
      win.open();
      

      Steps to reproduce

      1. Using the code above build for Windows Platform using appc run -p windows -T wp-emulator

      Actual result

      The first error will be shown, which gives the user no help in diagnosing the issue

      Expected result

      An error similar to the Android error should be shown, informing the user why the error was thrown

        Attachments

          Activity

            People

            • Assignee:
              kiguchi Kota Iguchi (Inactive)
              Reporter:
              eharris Ewan Harris
              Reviewer:
              Gary Mathews
              Tester:
              Samir Mohammed
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration