Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11216] Missing coverage for Script Error when handling TiExceptionHandler

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-10-17T22:13:52.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sRelease 3.0.0, Release 3.1.0, 2012 Sprint 21 Core, 2012 Sprint 21
ComponentsiOS
Labelscore, defect, ios, iphone, qe-port
ReporterJeff Haynie
AssigneeMax Stepanov
Created2012-09-30T05:48:37.000+0000
Updated2013-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).

Comments

  1. Jeff Haynie 2012-09-30

    submitted pull request at https://github.com/appcelerator/titanium_mobile/pull/3086
  2. Max Stepanov 2012-10-13

    app.js
       var 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");
       
    module.js
       throw new Error("Module module.js error");
       
  3. Max Stepanov 2012-10-16

    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.
  4. Vishal Duggal 2012-10-17

    Backport to 3_0_X https://github.com/appcelerator/titanium_mobile/pull/3266
  5. Olga Romero 2013-01-11

    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

JSON Source