From c1b9f3235f34d7cd37a0da94c0aa37b5d45947c5 Mon Sep 17 00:00:00 2001 From: lilia Date: Wed, 30 Sep 2015 11:45:15 -0700 Subject: [PATCH] Save all errors But clean up objects created by the Error constructor, as they contain non-serializable properties, like functions. // FREEBIE --- js/models/messages.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/js/models/messages.js b/js/models/messages.js index bbdd3ae72..62d8f5c9d 100644 --- a/js/models/messages.js +++ b/js/models/messages.js @@ -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));