[AC-5143] Titanium.App.uncaughtException does not get fired even when forcing JS errors
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2017-10-17T19:45:38.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Titanium SDK & CLI |
| Labels | n/a |
| Reporter | Muhammad Ahmed Fahad |
| Assignee | Shak Hossain |
| Created | 2017-08-16T04:28:11.000+0000 |
| Updated | 2019-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");
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();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.
Hello, This works for me on both iOS and Android, Tested in Android device and iOS simulator. SDK 6.2.2.GA. Thanks.