Skip to content

Commit fffba3a

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

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎lib/internal/errors.js‎

Lines changed: 2 additions & 2 deletions
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
constMainContextError=Error;
50-
constErrorToString=Error.prototype.toString;
5151
constoverrideStackTrace=newWeakMap();
5252
constkNoOverride=Symbol('kNoOverride');
5353
constprepareStackTrace=(globalThis,error,trace)=>{
@@ -68,7 +68,7 @@ const prepareStackTrace = (globalThis, error, trace) => {
6868
// Error: Message
6969
// at function (file)
7070
// at file
71-
consterrorString=ErrorToString.call(error);
71+
consterrorString=ErrorPrototypeToString(error);
7272
if(trace.length===0){
7373
returnerrorString;
7474
}

0 commit comments

Comments
 (0)