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

Android: Modify JSON.stringify(Error) to not return "{}"

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Low
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Release 7.5.0
    • Component/s: Android
    • Environment:
    • Sprint:
      2018 Sprint 09 SDK, 2018 Sprint 10 SDK, 2018 Sprint 11 SDK, 2018 Sprint 12 SDK, 2018 Sprint 13 SDK, 2018 Sprint 14 SDK, 2018 Sprint 15 SDK, 2018 Sprint 16 SDK, 2016 Sprint 17 SDK, 2018 Sprint 18 SDK, 2018 Sprint 19 SDK

      Description

      Hello !
      We were trying to log some handled exceptions with the APM module for Android (apm.logHandledException( ) ) and we just noticed whenever we try to instantiate a Javascript Error in Android , this always comes out as an empty object ( { } ), where as, when doing the very same thing in iOS will work with no issues.
      This however, has only been tested in simulators/emulators.

      It was also tested with Ti SDK 7.x and 6.x. In both cases new Error seems to be broken in Android, but working in iOS.

      Sample app: https://propelics.box.com/s/q8nryev5c6fc8eqzl3rem21jjd792vj4

      var e = new Error('Some error');
      var e2 = new Error();
       
      console.log('e=' + JSON.stringify(e));
      console.log('e2=' + JSON.stringify(e2));
      

      Steps to reproduce:
      1) Take a look at index.js and see how we're trying to instantiate 2 Error objects, then printing them in the console.
      2) Run the application in Android (we've been using emulators with Android 6.0 and 7.1.1)
      3) When the application launches look at the console. The printed logs will be empty objects:
      [INFO] e={}
      [INFO] e2={}
      4) Re-run the app in iOS
      5) Observe the console output and how actual error objects will be printed:
      [INFO] e=

      {"line":55,"column":19,"sourceURL":"file:///Users/user/Library/Developer/CoreSimulator/Devices/63801195-0FE5-4A3F-9615-F1ABAAB35DFC/data/Containers/Bundle/Application/D4F143DB-E591-4258-9567-6D294EBEB265/BlankApp.app/alloy/controllers/index.js"}

      [INFO] e2=

      {"line":56,"column":20,"sourceURL":"file:///Users/user/Library/Developer/CoreSimulator/Devices/63801195-0FE5-4A3F-9615-F1ABAAB35DFC/data/Containers/Bundle/Application/D4F143DB-E591-4258-9567-6D294EBEB265/BlankApp.app/alloy/controllers/index.js"}

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jquick Joshua Quick
                Reporter:
                aislam Aminul Islam
                Reviewer:
                Gary Mathews
                Tester:
                Lokesh Choudhary
              • Watchers:
                6 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 Source Code