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:
parent
37ff3cf5a8
commit
c1b9f3235f
1 changed files with 5 additions and 7 deletions
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue