Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5143] Titanium.App.uncaughtException does not get fired even when forcing JS errors

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionFixed
Resolution Date2017-10-17T19:45:38.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterMuhammad Ahmed Fahad
AssigneeShak Hossain
Created2017-08-16T04:28:11.000+0000
Updated2019-04-16T18:30:31.000+0000

Description

Titanium.App.uncaughtException does not get fired even when forcing JS errors
Ti.App.addEventListener("uncaughtException", function (e) {
  Ti.API.info("Uncaught JS exception captured");
});

var b = 1/a;
var c = a*b+c;
throw new Error("Error Capture Test");

Comments

  1. Hans Knöchel 2017-08-16

    Is this iOS or Android? The following works on iOS:
       /**
        * This file is used to validate iOS test-cases. It is ran using the Xcode
        * project in titanium_mobile/iphone/iphone/Titanium.xcodeproj.
        *
        * Change the below code to fit your use-case. By default, it included a button
        * to trigger a log that is displayed in the Xcode console.
        */
       
       var win = Ti.UI.createWindow({
           backgroundColor: '#fff'
       });
       
       Ti.App.addEventListener("uncaughtException", function (e) {
         Ti.API.info("Uncaught JS exception captured");
       });
        
       var btn = Ti.UI.createButton({
           title: 'Trigger'
       });
       
       btn.addEventListener('click', function() {
         var b = 1/a;
         var c = a*b+c;
         throw new Error("Error Capture Test");
       });
       
       win.add(btn);
       win.open();
       
  2. Muhammad Ahmed Fahad 2017-08-22

    It works on Android but does NOT work on iOS for me (both on device and simulator). Not sure what may be the difference in setup between your test project and ours. We are currently using "yy.logcatcher" to resolve this issue.
  3. Sharif AbuDarda 2017-10-17

    Hello, This works for me on both iOS and Android, Tested in Android device and iOS simulator. SDK 6.2.2.GA. Thanks.

JSON Source