Define a callback function to catch thrown errors messages.
Example - Catch JS Errors
function OnStart()
{
app.SetOnError( OnError );
throw "My thrown error";
}
function OnError( msg, line, file )
{
var text =
'Message: "' + msg + '"\n' +
'Line: ' + line + '\n' +
'File: "' + app.Uri2Path(file) + '"';
app.Alert( text, "Received error message:" );
}