Skip to content

Commit fffba3a

Browse files
ExE-Bossrichardlau
authored andcommitted
errors: use ErrorPrototypeToString from primordials object
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]>
1 parent be71e71 commit fffba3a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/internal/errors.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
const {
1414
ArrayIsArray,
1515
Error,
16+
ErrorPrototypeToString,
1617
JSONStringify,
1718
Map,
1819
MathAbs,
@@ -47,7 +48,6 @@ const kTypes = [
4748
];
4849

4950
const MainContextError = Error;
50-
const ErrorToString = Error.prototype.toString;
5151
const overrideStackTrace = new WeakMap();
5252
const kNoOverride = Symbol('kNoOverride');
5353
const prepareStackTrace = (globalThis, error, trace) => {
@@ -68,7 +68,7 @@ const prepareStackTrace = (globalThis, error, trace) => {
6868
// Error: Message
6969
// at function (file)
7070
// at file
71-
const errorString = ErrorToString.call(error);
71+
const errorString = ErrorPrototypeToString(error);
7272
if (trace.length === 0) {
7373
return errorString;
7474
}

0 commit comments

Comments
 (0)