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 <me@gus.host>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
ExE-Boss authored and addaleax committed Sep 22, 2020
1 parent 4165a08 commit 593baaf
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 593baaf

Please sign in to comment.