Skip to content

Commit

Permalink
Merge pull request #195 from jalleyne/master
Browse files Browse the repository at this point in the history
Catch JSON stringily errors.
  • Loading branch information
thebigredgeek authored Nov 14, 2016
2 parents 2caf4ef + 6830d9f commit 3491ad6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ function useColors() {
*/

exports.formatters.j = function(v) {
return JSON.stringify(v);
try {
return JSON.stringify(v);
}catch( err){
return '[UnexpectedJSONParseError]: ' + err.message;
}
};


Expand Down
6 changes: 5 additions & 1 deletion dist/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,11 @@ function useColors() {
*/

exports.formatters.j = function(v) {
return JSON.stringify(v);
try {
return JSON.stringify(v);
}catch( err){
return '[UnexpectedJSONParseError]: ' + err.message;
}
};


Expand Down

0 comments on commit 3491ad6

Please sign in to comment.