in JS, you can throw a "new Error(message)", but if you want to detect the type of the exception and do something different with the message, it is not so easy.
This post: http://www.nczonline.net/blog/2009/03/10/the-art-of-throwing-javascript-errors-part-2/
Is saying you can do it something like this:
function MyError(message){
this.message=messsage;
this.name="MyError";
this.poo="poo";
}
MyError.prototype = new Error();
try{
alert("hello hal");
throw new MyError("wibble");
} catch (er) {
alert (er.poo); // undefined.
alert (er instanceof MyError); // false
alert (er.name); // ReferenceError.
}
But it does not work (get "undefined" and false)
Is this even possible?