From 5c968a0f92df50653afa90070114b6996d2af2aa Mon Sep 17 00:00:00 2001 From: ExE Boss <3889017+ExE-Boss@users.noreply.github.com> Date: Sun, 23 Aug 2020 17:40:00 +0200 Subject: [PATCH] =?UTF-8?q?errors:=20use=C2=A0`ErrorPrototypeToString`=20f?= =?UTF-8?q?rom=C2=A0`primordials`=C2=A0object?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/34891 Reviewed-By: Gus Caplan Reviewed-By: Michaƫl Zasso Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig --- lib/internal/errors.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 42257b2755f7a2..507fde4352d39e 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -13,6 +13,7 @@ const { ArrayIsArray, Error, + ErrorPrototypeToString, JSONStringify, Map, MathAbs, @@ -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) => { @@ -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; }