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:
@@ -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));
|
||||
|
Reference in New Issue
Block a user