Skip to content

Commit

Permalink
errors: use ErrorPrototypeToString from primordials object
Browse files Browse the repository at this point in the history
PR-URL: #34891
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
ExE-Boss authored and addaleax committed Sep 22, 2020
1 parent 36c705d commit 5c968a0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
const {
ArrayIsArray,
Error,
ErrorPrototypeToString,
JSONStringify,
Map,
MathAbs,
Expand Down Expand Up @@ -50,7 +51,6 @@ const kTypes = [
const { kMaxLength } = internalBinding('buffer');

const MainContextError = Error;
const ErrorToString = Error.prototype.toString;
const overrideStackTrace = new WeakMap();
const kNoOverride = Symbol('kNoOverride');
const prepareStackTrace = (globalThis, error, trace) => {
Expand All @@ -71,7 +71,7 @@ const prepareStackTrace = (globalThis, error, trace) => {
// Error: Message
// at function (file)
// at file
const errorString = ErrorToString.call(error);
const errorString = ErrorPrototypeToString(error);
if (trace.length === 0) {
return errorString;
}
Expand Down

0 comments on commit 5c968a0

Please sign in to comment.