[TIMOB-11652] iOS: Add script errors/stack trace to TiExceptionHandler data
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-01-16T10:19:40.000+0000 |
Affected Version/s | Release 3.0.0 |
Fix Version/s | Release 3.0.2, Release 3.1.0, 2012 Sprint 23 API, 2012 Sprint 23 |
Components | Core |
Labels | exception, qe-port, triage |
Reporter | Max Stepanov |
Assignee | Blain Hamon |
Created | 2012-11-02T17:16:43.000+0000 |
Updated | 2014-07-06T20:11:52.000+0000 |
Description
JavaScript:
// Without try catch:
var err = new Error("My Awesome Caught Error!");
API.logHandledException(err);
try {
var err = new Error("My Awesome Caught Error!");
throw err
} catch (err){
API.logHandledException(err);
}
Objective-C:
-(void)logHandledException:(id)args
{
TiLogMessage([NSString stringWithFormat:@"class type?: %@", [[args objectAtIndex:0] class]]); // This returns as NSDictionary, is this expected?
// TiScriptError *exception = [TiScriptError initWithDictionary:[args objectAtIndex:0]]; // This selector doesn't exist?
TiScriptError *exception = (TiScriptError *)args; // Returns an array, not a single object. In other methods, they returned the objects rather than an array of parameters.
[API logHandledException:[self convertScriptErrorToNative:exception]];
}
Reopening so that we can bring TiJSCore in. Also, documentation.
A test case:
Output will be something like:
The expected result should contain valid 'backtrace' property:value pair.
Closing. Tested and verified fix with: Device: iPhone5 iOS 6.0 Titanium Studio, build: 3.0.1.201212181159 Titanium SDK, build: 3.0.2.v20130125153221 Titanium SDK, build:3.1.0.v20130125152545 Similar output.