Reputation: 31
I recently updated from nodejs v0.4.9 to v0.6.11 and noticed none of my stack traces were showing up. I depended on a few of those to for validating tests. Anyone know whats up or if theres a different way to do it?
Upvotes: 3
Views: 4297
Reputation: 273546
Tested today (Nov 9, 2013) with Node v0.10.5, this works:
var ParseError = exports.ParseError = function(message) {
Error.captureStackTrace(this, ParseError);
this.message = message;
}
ParseError.prototype = Object.create(Error.prototype);
ParseError.prototype.constructor = ParseError;
When new ParseError('some message')
is thrown, it carries the stack
attribute as expected when caught.
Upvotes: 3