@@ -65,14 +65,15 @@ export function eventFromUnknownInput(
6565) : Event {
6666 let event : Event ;
6767
68- if ( isErrorEvent ( exception ) ) {
68+ if ( isErrorEvent ( exception as ErrorEvent ) && ( exception as ErrorEvent ) . error ) {
6969 // If it is an ErrorEvent with `error` property, extract it to get actual Error
70+ const errorEvent = exception as ErrorEvent ;
7071 // eslint-disable-next-line no-param-reassign
71- exception = exception . error ;
72- event = eventFromStacktrace ( computeStackTrace ( exception ) ) ;
72+ exception = errorEvent . error ;
73+ event = eventFromStacktrace ( computeStackTrace ( exception as Error ) ) ;
7374 return event ;
7475 }
75- if ( isDOMError ( exception ) || isDOMException ( exception ) ) {
76+ if ( isDOMError ( exception as DOMError ) || isDOMException ( exception as DOMException ) ) {
7677 // If it is a DOMError or DOMException (which are legacy APIs, but still supported in some browsers)
7778 // then we just extract the name, code, and message, as they don't provide anything else
7879 // https://developer.mozilla.org/en-US/docs/Web/API/DOMError
@@ -89,9 +90,9 @@ export function eventFromUnknownInput(
8990
9091 return event ;
9192 }
92- if ( isError ( exception ) ) {
93+ if ( isError ( exception as Error ) ) {
9394 // we have a real Error object, do nothing
94- event = eventFromStacktrace ( computeStackTrace ( exception ) ) ;
95+ event = eventFromStacktrace ( computeStackTrace ( exception as Error ) ) ;
9596 return event ;
9697 }
9798 if ( isPlainObject ( exception ) || isEvent ( exception ) ) {
0 commit comments