Save all errors

But clean up objects created by the Error constructor, as they contain
non-serializable properties, like functions.

// FREEBIE
This commit is contained in:
lilia 2015-09-30 11:45:15 -07:00
parent 37ff3cf5a8
commit c1b9f3235f

View file

@ -144,14 +144,12 @@
console.log(e);
console.log(e.reason, e.stack);
});
message.save({
errors : errors.filter(function(e) {
switch(e.name) {
case 'OutgoingIdentityKeyError':
case 'HTTPError':
return true;
this.save({
errors : errors.map(function(e) {
if (e.constructor === Error) {
return _.pick(e, 'name', 'message', 'number', 'reason');
}
return false;
return e;
})
});
}.bind(this));