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 richardlau committed Sep 1, 2020
1 parent be71e71 commit fffba3a
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 @@ -47,7 +48,6 @@ const kTypes = [
];

const MainContextError = Error;
const ErrorToString = Error.prototype.toString;
const overrideStackTrace = new WeakMap();
const kNoOverride = Symbol('kNoOverride');
const prepareStackTrace = (globalThis, error, trace) => {
Expand All @@ -68,7 +68,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 fffba3a

Please sign in to comment.