Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Commit 2b23e70

Browse files
author
Mike Kaufman
committed
fixing lib/error isStackOverflowError to work on node-chakracore
1 parent 398f339 commit 2b23e70

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/internal/errors.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,8 @@ function dnsException(err, syscall, hostname) {
569569
return ex;
570570
}
571571

572-
let MAX_STACK_MESSAGE;
572+
let MAX_STACK_ERROR_NAME;
573+
let MAX_STACK_ERROR_MESSAGE;
573574
/**
574575
* Returns true if `err` is a `RangeError` with an engine-specific message.
575576
* "Maximum call stack size exceeded" in V8.
@@ -578,16 +579,17 @@ let MAX_STACK_MESSAGE;
578579
* @returns {boolean}
579580
*/
580581
function isStackOverflowError(err) {
581-
if (MAX_STACK_MESSAGE === undefined) {
582+
if (MAX_STACK_ERROR_MESSAGE === undefined) {
582583
try {
583584
function overflowStack() { overflowStack(); }
584585
overflowStack();
585586
} catch (err) {
586-
MAX_STACK_MESSAGE = err.message;
587+
MAX_STACK_ERROR_MESSAGE = err.message;
588+
MAX_STACK_ERROR_NAME = err.name;
587589
}
588590
}
589591

590-
return err.name === 'RangeError' && err.message === MAX_STACK_MESSAGE;
592+
return err.name === MAX_STACK_ERROR_NAME && err.message === MAX_STACK_ERROR_MESSAGE;
591593
}
592594

593595
module.exports = exports = {

0 commit comments

Comments
 (0)