@@ -65,14 +65,15 @@ export function eventFromUnknownInput(
65
65
) : Event {
66
66
let event : Event ;
67
67
68
- if ( isErrorEvent ( exception ) ) {
68
+ if ( isErrorEvent ( exception as ErrorEvent ) && ( exception as ErrorEvent ) . error ) {
69
69
// If it is an ErrorEvent with `error` property, extract it to get actual Error
70
+ const errorEvent = exception as ErrorEvent ;
70
71
// 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 ) ) ;
73
74
return event ;
74
75
}
75
- if ( isDOMError ( exception ) || isDOMException ( exception ) ) {
76
+ if ( isDOMError ( exception as DOMError ) || isDOMException ( exception as DOMException ) ) {
76
77
// If it is a DOMError or DOMException (which are legacy APIs, but still supported in some browsers)
77
78
// then we just extract the name, code, and message, as they don't provide anything else
78
79
// https://developer.mozilla.org/en-US/docs/Web/API/DOMError
@@ -89,9 +90,9 @@ export function eventFromUnknownInput(
89
90
90
91
return event ;
91
92
}
92
- if ( isError ( exception ) ) {
93
+ if ( isError ( exception as Error ) ) {
93
94
// we have a real Error object, do nothing
94
- event = eventFromStacktrace ( computeStackTrace ( exception ) ) ;
95
+ event = eventFromStacktrace ( computeStackTrace ( exception as Error ) ) ;
95
96
return event ;
96
97
}
97
98
if ( isPlainObject ( exception ) || isEvent ( exception ) ) {
0 commit comments