Short question: what does the exception "sourceID" refer to and how can I associate it with the corresponding source line / file?
Longer:
I run Javascript code in my own iPhone application through [UIWebView stringByEvaluatingJavaScriptFromString:]. To help develop and then verify the code provided by the user, I use the following function to safely run any code:
- (NSString *)runJS:(NSString *)js {
js = escape(js);
NSString *result =
[webView stringByEvaluatingJavaScriptFromString:
[NSString stringWithFormat:@"try { JSON.stringify(eval(\"%@\")); } except (e) { JSON.stringify(e); }", js]
];
return result;
}
If everything goes well, it [MyJS runJS:js]works fine and returns a JSON string containing the result of evaluating the last statement in the 'js' code.
Now, if bad things happen during the evaluation, I get a JSONified exception object. For example, in the case of a syntax error in the "js" code, I get something like this:
{ "message": "Parse error", "line": 1, "sourceId": 26121296}
...
, runJS:, , ( , javascript). sourceId , , . ( ), , . ?
: - javascript, UIWebView, , ? - Safari , .