33 apply ,
44 construct ,
55 defineProperties ,
6+ getPrototypeOf ,
7+ uncurryThis ,
68 setPrototypeOf ,
79 getOwnPropertyDescriptor ,
810 defineProperty ,
@@ -43,6 +45,7 @@ export default function tameErrorConstructor(
4345 prepareStackTrace : originalPrepareStackTrace ,
4446 } = FERAL_ERROR ;
4547 let platform = 'unknown' ;
48+ let callSiteToStringFallback ;
4649 if ( typeof originalCaptureStackTrace === 'function' ) {
4750 // we might be on v8
4851 if ( typeof originalPrepareStackTrace === 'function' ) {
@@ -65,6 +68,27 @@ export default function tameErrorConstructor(
6568 // error stack logic is close enough that we can treat it
6669 // like v8.
6770 platform = 'v8' ;
71+
72+ if ( `${ sst [ 0 ] } ` === '[object CallSite]' ) {
73+ const csProto = getPrototypeOf ( sst [ 0 ] ) ;
74+
75+ const [
76+ getFunctionName ,
77+ getMethodName ,
78+ getFileName ,
79+ getLineNumber ,
80+ getColumnNumber ,
81+ ] = [
82+ uncurryThis ( csProto . getFunctionName ) ,
83+ uncurryThis ( csProto . getMethodName ) ,
84+ uncurryThis ( csProto . getFileName ) ,
85+ uncurryThis ( csProto . getLineNumber ) ,
86+ uncurryThis ( csProto . getColumnNumber ) ,
87+ ] ;
88+
89+ callSiteToStringFallback = callSite =>
90+ `${ getFunctionName ( callSite ) || getMethodName ( callSite ) } (${ getFileName ( callSite ) } :${ getLineNumber ( callSite ) } :${ getColumnNumber ( callSite ) } )` ;
91+ }
6892 }
6993 } ;
7094 const sacrificialError = new FERAL_ERROR ( 'just for testing' ) ;
@@ -247,6 +271,7 @@ export default function tameErrorConstructor(
247271 InitialError ,
248272 errorTaming ,
249273 stackFiltering ,
274+ callSiteToStringFallback ,
250275 ) ;
251276 } else if ( errorTaming === 'unsafe' || errorTaming === 'unsafe-debug' ) {
252277 // v8 has too much magic around their 'stack' own property for it to
0 commit comments