11import { addGlobalEventProcessor , getCurrentHub } from '@sentry/core' ;
22import { Event , EventHint , Exception , ExtendedError , Integration } from '@sentry/types' ;
3- import { SyncPromise } from '@sentry/utils' ;
3+ import { isInstanceOf , SyncPromise } from '@sentry/utils' ;
44
55import { getExceptionFromError } from '../parsers' ;
66
@@ -53,12 +53,12 @@ export class LinkedErrors implements Integration {
5353 * @inheritDoc
5454 */
5555 public handler ( event : Event , hint ?: EventHint ) : PromiseLike < Event > {
56- if ( ! event . exception || ! event . exception . values || ! hint || ! ( hint . originalException instanceof Error ) ) {
56+ if ( ! event . exception || ! event . exception . values || ! hint || ! isInstanceOf ( hint . originalException , Error ) ) {
5757 return SyncPromise . resolve ( event ) ;
5858 }
5959
6060 return new SyncPromise < Event > ( resolve => {
61- this . walkErrorTree ( hint . originalException as ExtendedError , this . _key )
61+ this . walkErrorTree ( hint . originalException as Error , this . _key )
6262 . then ( ( linkedErrors : Exception [ ] ) => {
6363 if ( event && event . exception && event . exception . values ) {
6464 event . exception . values = [ ...linkedErrors , ...event . exception . values ] ;
@@ -75,7 +75,7 @@ export class LinkedErrors implements Integration {
7575 * @inheritDoc
7676 */
7777 public walkErrorTree ( error : ExtendedError , key : string , stack : Exception [ ] = [ ] ) : PromiseLike < Exception [ ] > {
78- if ( ! ( error [ key ] instanceof Error ) || stack . length + 1 >= this . _limit ) {
78+ if ( ! isInstanceOf ( error [ key ] , Error ) || stack . length + 1 >= this . _limit ) {
7979 return SyncPromise . resolve ( stack ) ;
8080 }
8181 return new SyncPromise < Exception [ ] > ( ( resolve , reject ) => {
0 commit comments