Code: Select all
app.onError = err;
function err(errString) {
alert(errString);
}
app.onError = err;
Hi there can anybody give me an example of how to use the code above to test if a statment is giving an error,
let the alert happen and if it does, to exit the current script/function?
I'm a bit hazy on callback functions, so not sure how to integrate it into a script.
Thanks a lot.
Code: Select all
function testError(statment) { // the code being a statment.
statment
function appError(errString) { //define error response.
alert(errString);
//error was triggered.
$.writeln("error triggered.");
} //close sub
if (app.onError){
app.onError=appError;
return true;
}
else{
return false;
}