Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
lib: fix stack overflow check to not break on primitives
  • Loading branch information
kball committed Jun 21, 2019
commit c32abb9a0bd2fc6fad22f7354af4d5b835aedefd
2 changes: 1 addition & 1 deletion lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ function isStackOverflowError(err) {
}
}

return err.name === maxStack_ErrorName &&
return err && err.name === maxStack_ErrorName &&
err.message === maxStack_ErrorMessage;
}

Expand Down
14 changes: 14 additions & 0 deletions test/parallel/test-console-log-throw-primitive.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';
require('../common');
const { Writable } = require('stream');
const { Console } = require('console');

const stream = new Writable({
write() {
throw null; // eslint-disable-line no-throw-literal
}
});

const console = new Console({ stdout: stream });

console.log('test'); // Should not throw