To what do you intend "this" to refer to in the body of MyError()? When using "this", it is usually a direct reference to the workable object itself, but unless MyError is a method of a class, it is not in an object context.
Instead, do something like:
myObj = new Object;
myObj.message = msg;
myObj.name = "My Error";
It is also considered good practice to always end every statement with a semicolon.