Back

SetOnError

Hello World

Define a callback function to catch thrown errors messages.

app.SetOnError( callback )

See also: Error

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:" );
}
    Copy     Copy All       Run      
function( error )