Thsi needs to be done internally to the class, not with an external "try" clause. In some languages this is known as a __resolve function.
thus
Expand|Select|Wrap|Line Numbers
- var foo = new MyClass()
- function MyClass(){
- this.dog = "woof"
- function __resolve(e) {
- alert("I don't know what a" + e + "is");
- }
- }
- alert(foo.dog) // woof
- foo.cat() // I don't know what a cat is