Skip to content

Commit

Permalink
fix: correctly handle falsy values
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Nov 4, 2018
1 parent f09172a commit 367fb19
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions examples/special.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ consola.log({
consola.log('%d', 12)

consola.error({ type: 'CSSError', message: 'Use scss' })

consola.error(undefined, null, false, true, NaN)
2 changes: 1 addition & 1 deletion src/reporters/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class BasicReporter {

formatArgs (args) {
const _args = args.map(arg => {
if (arg.stack) {
if (arg && typeof arg.stack === 'string') {
return arg.message + '\n' + this.formatStack(arg.stack)
}
return arg
Expand Down

0 comments on commit 367fb19

Please sign in to comment.