From 34eeb934705bcc7b17a97323f90f5ddbc702a5d7 Mon Sep 17 00:00:00 2001 From: lilia Date: Tue, 27 Sep 2016 14:16:58 -0700 Subject: [PATCH] Better debug output when JSON encoding fails --- dist/libsignal-protocol.js | 7 ++++++- src/SessionRecord.js | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/dist/libsignal-protocol.js b/dist/libsignal-protocol.js index a66b833..2f77791 100644 --- a/dist/libsignal-protocol.js +++ b/dist/libsignal-protocol.js @@ -35541,7 +35541,12 @@ Internal.SessionRecord = function() { } else if (thing === Object(thing)) { var obj = {}; for (var key in thing) { - obj[key] = ensureStringed(thing[key]); + try { + obj[key] = ensureStringed(thing[key]); + } catch (ex) { + console.log('Error serializing key', key); + throw ex; + } } return obj; } else if (thing === null) { diff --git a/src/SessionRecord.js b/src/SessionRecord.js index e0bbea6..2d56661 100644 --- a/src/SessionRecord.js +++ b/src/SessionRecord.js @@ -42,7 +42,12 @@ Internal.SessionRecord = function() { } else if (thing === Object(thing)) { var obj = {}; for (var key in thing) { - obj[key] = ensureStringed(thing[key]); + try { + obj[key] = ensureStringed(thing[key]); + } catch (ex) { + console.log('Error serializing key', key); + throw ex; + } } return obj; } else if (thing === null) {