diff --git a/browser.js b/browser.js index 55f4cf92..ab495871 100644 --- a/browser.js +++ b/browser.js @@ -59,7 +59,11 @@ function useColors() { */ exports.formatters.j = function(v) { - return JSON.stringify(v); + try { + return JSON.stringify(v); + }catch( err){ + return '[UnexpectedJSONParseError]: ' + err.message; + } }; diff --git a/dist/debug.js b/dist/debug.js index 97d6f787..e6732b86 100644 --- a/dist/debug.js +++ b/dist/debug.js @@ -384,7 +384,11 @@ function useColors() { */ exports.formatters.j = function(v) { - return JSON.stringify(v); + try { + return JSON.stringify(v); + }catch( err){ + return '[UnexpectedJSONParseError]: ' + err.message; + } };