[TIMOB-11216] Missing coverage for Script Error when handling TiExceptionHandler
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2012-10-17T22:13:52.000+0000 |
| Affected Version/s | Release 3.0.0 |
| Fix Version/s | Release 3.0.0, Release 3.1.0, 2012 Sprint 21 Core, 2012 Sprint 21 |
| Components | iOS |
| Labels | core, defect, ios, iphone, qe-port |
| Reporter | Jeff Haynie |
| Assignee | Max Stepanov |
| Created | 2012-09-30T05:48:37.000+0000 |
| Updated | 2013-01-11T16:59:17.000+0000 |
Description
There are at least 3 (see below) places where a script error is not handled by the TiExceptionHandler in the code.
KrollBridge.m line 735
KrollContext.m line 627
KrollContext.m line 642
At these locations, we are required to call:
[[TiExceptionHandler defaultExceptionHandler] reportScriptError:scriptError];
with a script error object (see KrollBridge.m line 462 for example) so that a custom exception handler can handle all script errors (not just one on loading a source into the VM).
submitted pull request at https://github.com/appcelerator/titanium_mobile/pull/3086
app.js
module.jsvar win = Titanium.UI.createWindow({ backgroundColor:'#fff', layout: 'vertical' }); var button1 = Ti.UI.createButton({ title:'Instant error', height:40, width:200, }); button1.addEventListener('click',function(e) { throw new Error("Event handler error"); }); var button2 = Ti.UI.createButton({ title:'Timeout error', height:40, width:200, }); button2.addEventListener('click',function(e) { setTimeout(function(e) { throw new Error("Timeout error"); }, 1000); }); var button3 = Ti.UI.createButton({ title:'Require error', height:40, width:200, }); button3.addEventListener('click',function(e) { require('module'); }); win.add(button1); win.add(button2); win.add(button3); win.open(); throw new Error("Main app.js error");throw new Error("Module module.js error");PR submitted https://github.com/appcelerator/titanium_mobile/pull/3246 It handles 3 cases mentioned in the description plus extra 4: KrollCallback, KrollObject, KrollTimer and TiBindingEvent.
Backport to 3_0_X https://github.com/appcelerator/titanium_mobile/pull/3266
Closing as fixed. Verified with: Titanium Studio, build: 3.0.1.201212181159 Titanium SDK, build: 3.0.0.GA Titanium SDK, build: 3.1.0.v20130109175536 Mountain Lion 10.8.2 iPhone5 iOS 6.0 iPad4 iOS 6.0 GalaxyS3 Android version 4.0.4