I would like some way to hook into whenever the Error contractor is called. I'll let you know what I'm doing in case there is some other way to accomplish this, but basically I am trying to get access to the actual stack trace for Error objects, without breaking the stack property. I've tried doing an object->Clone() on the error, setting a custom Error.prepareStackTrace, calling stack, then resetting Error.prepareStackTrace, and this almost works, but on some versions of chrome this still breaks the original error:
Error.prepareStackTrace = function(e, s) { stack = s };
clone = clone(error);
Error.prepareStackTrace = function() { } // fine in v8 used in node 5, 0.12, and 0.10, but breaks in node 6
SO, if there were some way to hook into the actual Error constructor, I could just instantiate a NEW error at that point, and keep it hidden away in a WeakMap so that when I needed to check the stack, I could do with it as I please without affecting the real one.