Open LudgerPeters opened 8 years ago
Another alternative is that you can add the following code at startup and then JSON.stringify works as expected:
Object.defineProperty(Error.prototype, 'message', {
configurable: true,
enumerable: true
});
Object.defineProperty(Error.prototype, 'stack', {
configurable: true,
enumerable: true
});
credit for the above suggestion goes to cheolgook over at stackoverflow
I think you can use the following codes:
// hack on Error
Object.defineProperty(Error.prototype, 'toJSON', {
configurable: true,
value: function () {
var alt = {};
var storeKey = function (key) {
alt[key] = this[key];
};
Object.getOwnPropertyNames(this).forEach(storeKey, this);
return alt;
}
});
The alpha release has fixed this problem. Be sure to check it out.
When i try and log a error it shows up as a empty object {} I found something interesting http://stackoverflow.com/questions/18391212/is-it-not-possible-to-stringify-an-error-using-json-stringify Looks like json stringify does not handle errors. I replaced line 405 of console2 to:
Is there something else i can do to get scribe to log the error messages?