@@ -30,7 +30,10 @@ interface CallSite {
3030/**
3131 * Parse call sites from error instance.
3232 */
33- function getErrorStack ( error : Error ) : CallSite [ ] {
33+ function getErrorStack (
34+ error : Error ,
35+ constructor : ( ...args : any [ ] ) => any
36+ ) : CallSite [ ] {
3437 const prepareStackTrace = Error . prepareStackTrace ;
3538 let trace : CallSite [ ] ;
3639
@@ -39,7 +42,7 @@ function getErrorStack(error: Error): CallSite[] {
3942 return prepareStackTrace ?.( error , v8Trace ) ;
4043 } ;
4144
42- Error . captureStackTrace ( error , getErrorStack ) ;
45+ Error . captureStackTrace ( error , constructor ) ;
4346 error . stack ; // Triggers `prepareStackTrace`.
4447 Error . prepareStackTrace = prepareStackTrace ;
4548
@@ -158,7 +161,10 @@ export class Sentry {
158161 /**
159162 * Sends the exception to Sentry and returns the `Response` promise.
160163 */
161- captureException ( error : Error , options : CaptureExceptionOptions = { } ) {
164+ captureException (
165+ error : Error ,
166+ options : CaptureExceptionOptions = { }
167+ ) : Promise < Response > {
162168 // https://develop.sentry.dev/sdk/event-payloads/
163169 const request = new Request (
164170 `https://sentry.io/api${ this . sentryUrl . pathname } /store/` ,
@@ -183,16 +189,18 @@ export class Sentry {
183189 value : error . message ,
184190 // Ref: https://develop.sentry.dev/sdk/event-payloads/stacktrace
185191 stacktrace : {
186- frames : getErrorStack ( error ) . map ( ( callSite ) => ( {
187- function : callSite . getFunctionName ( ) ,
188- filename : this . filePrefix + callSite . getFileName ( ) ,
189- lineno : callSite . getLineNumber ( ) ,
190- colno : callSite . getColumnNumber ( ) ,
191- in_app : ! callSite . isNative ( ) ,
192- vars : {
193- this : String ( callSite . getThis ( ) ) ,
194- } ,
195- } ) ) ,
192+ frames : getErrorStack ( error , this . captureException ) . map (
193+ ( callSite ) => ( {
194+ function : callSite . getFunctionName ( ) ,
195+ filename : this . filePrefix + callSite . getFileName ( ) ,
196+ lineno : callSite . getLineNumber ( ) ,
197+ colno : callSite . getColumnNumber ( ) ,
198+ in_app : ! callSite . isNative ( ) ,
199+ vars : {
200+ this : callSite . getTypeName ( ) ,
201+ } ,
202+ } )
203+ ) ,
196204 } ,
197205 } ,
198206 ] ,
0 commit comments