Skip to content

Commit

Permalink
Update utils.js
Browse files Browse the repository at this point in the history
%j ->  Error   , Use JSON.stringify()  return {}
  • Loading branch information
qingfeng365 committed Feb 13, 2016
1 parent e0be6b7 commit cf631a3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ exports.format = function(f) {
return Number(args[i++]);
case '%j':
try {
return JSON.stringify(args[i++]);
if (args[i] instanceof Error) {
return JSON.stringify(args[i++], ['message', 'stack', 'type', 'name']);
} else {
return JSON.stringify(args[i++]);
}
} catch(e) {
return '[Circular]';
}
Expand Down

0 comments on commit cf631a3

Please sign in to comment.