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

Android: Hyperloop - A meaningful error message should appear If you try to stringify an object instance

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: Release 5.4.0
    • Fix Version/s: None
    • Component/s: Android, Hyperloop
    • Labels:
    • Environment:

      Appc CLI NPM: 4.2.7
      Appc CLI Core: 5.4.0-33
      Arrow: 1.8.2
      SDK: 5.4.0.v20160720201924
      Hyperloop: 1.2.3
      Node: v4.4.7
      OS: Mac OS X (10.11.5)
      Devices: Samsung Galaxy S5 (4.4.2), Genymotion Emulator (5.1.0)

    • Story Points:
      5

      Description

      Details: Currently with Android Hyperloop, if you try to stringify an object instance, a Uncaught RangeError: Maximum call stack size exceeded runtime error is thrown. This is expected, but the returned error message looks like this:

      [ERROR] TiExceptionHandler: (main) [9945,9945] ----- Titanium Javascript Runtime Error -----
      [ERROR] TiExceptionHandler: (main) [0,9945] - In ti:/titanium.js:0,0
      [ERROR] TiExceptionHandler: (main) [0,9945] - Message: Uncaught RangeError: Maximum call stack size exceeded
      [ERROR] TiExceptionHandler: (main) [0,9945] - Source: (function (exports, require, module, __filename, __dirname, Titanium, Ti, glob
      [ERROR] V8Exception: Exception occurred at ti:/titanium.js:0: Uncaught RangeError: Maximum call stack size exceeded
      [ERROR] V8Exception: RangeError: Maximum call stack size exceeded
      

      On iOS, if you stringify an object instance, you will get back a meaningful error message:

      [ERROR] Script Error {
      [ERROR]     column = 35;
      [ERROR]     line = 14;
      [ERROR]     message = "JSON.stringify cannot serialize cyclic structures.";
      [ERROR]     sourceURL = "file:///Users/wilson_san/Library/Developer/CoreSimulator/Devices/E0D90275-BCED-43E8-9A05-36D3BBF73A52/data/Containers/Bundle/Application/F53BA1D6-12DA-4D52-A229-D1CDA2B87800/monkey23198.app/alloy/controllers/index.js";
      [ERROR]     stack = "stringify@[native code]\ndoClick@file:///Users/wilson_san/Library/Developer/CoreSimulator/Devices/E0D90275-BCED-43E8-9A05-36D3BBF73A52/data/Containers/Bundle/Application/F53BA1D6-12DA-4D52-A229-D1CDA2B87800/monkey23198.app/alloy/controllers/index.js:14:35";
      [ERROR] } 
      [ERROR] 2016-07-21 13:14:36.120 monkey23198[38836:3930678] Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<UIAlertController: 0x7fa96bc3a190>)
      [TRACE] [monkey23198] Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<UIAlertController: 0x7fa96bc3a190>)
      [ERROR]   
      

      Steps to reproduce:

      1. Create a Hylperloop enabled project: appc new
      2. In the index.js, replace the code with this:

        var String = require('java.lang.String');
         
        function doClick(e) {
            alert($.label.text);
            var empty = new String();
            console.log(JSON.stringify(empty));
        }
         
        $.index.open();
        

      3. Install the app to an Android device/emulator: appc run -p android

      Actual: A RangeError: Maximum call stack size exceeded runtime error is thrown; see above for stack trace.

      Expected: A meaningful message should appear for Android, similar to iOS.

        Attachments

          Activity

            People

            • Assignee:
              jvennemann Jan Vennemann
              Reporter:
              wluu Wilson Luu (Inactive)
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:

                Backbone Issue Sync

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

                  Git Integration