I've got an object with functions that throw errors,
myObj = {
ini:function(){
this.f();
},
f:function(){
throw new Error();
}
};
but I only want to catch the exceptions where the object is created
try{
var o = new myObj();
}catch(err){
alert("error!");
}
it looks like i have to have try/catch blocks everywhere =/ to capture the error event in different function scopes
try{
myObj = {
ini:function(){
try{
this.f();
}catch(err){
alert("f threw an err");
}
},
f:function(){
throw new Error();
}
};
}catch(err){
alert("error happend while crating Obj");
}
But I only want to capture from one place =/ How do I do this?