2008/3/7 Ash Berlin <[EMAIL PROTECTED]>:
> I forget all the problems, but from memory the main one is that:
>
> MyError = function() {};
> MyError.prototype = Error.prototype;
>
> Doesn't do what you'd expect. And doing
>
> MyError.prototype = new Error();
>
> Is no good since then the filename and linenumber will be of that line, not
> where you create the MyError instance.

Right, and the idea of mutating an object when it's thrown in order to
reset its stack information seems bogus.

What about Error.prototype.throw, which would throw |this|, and act as
a hook for the stack/location setting implementation behaviour?  We
might want to permit an implementation to elide the
Error.prototype.throw frame itself in whatever stack reflection is
provided (though if E.p.throw has an internal error of some kind, it
should probably be visible in the trace).

(We could also put it on Object.prototype, which would make
|e.throw()| work for almost all values of e rather than just Errors,
but that might be a bit beyond the pale.)

Mike
_______________________________________________
Es4-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es4-discuss

Reply via email to