One option would be to use try\catch\throw
Assert = function ( expectedTrue, comment ) {
if( ! expectedTrue ) {
Log.Error( comment );
throw "OOPS";
}
}
try{
// function that users Assert
Test123 ( ... )
}
catch(err){
alert(err);
if (err=="OOPS"){
//special handling for a certain exception
}
}
Using this flow, the moment the exception is thrown, it will propagate upwards until it reaches the catch block for you to handle the exception.
Also, the exception isn't limited to be a string. It can be an integer, Boolean or an object.