So in my app when a particular condition occurs, I want to display an alert and then stop program execution. I read somewhere that this can be done with a throw() but I'm unable to make that work.
Here's what I've tried:
function check_for_error(data) {
try {
if ( <error condition> ) {
throw "error";
}
} catch(e) {
alert('error occured');
// I want program execution to halt here but it does not,
// it continues within the calling code
}
}