44 PluginContext
55} from "@exceptionless/core" ;
66
7- declare let $ : ( document : Document ) => { ( ) : any ; new ( ) : any ; ajaxError : { ( document : ( event : Event , xhr : { responseText : string ; status : number ; } , settings : { data : unknown ; url : string ; } , error : string ) => void ) : void ; new ( ) : any ; } ; } ;
7+ declare let $ : ( document : Document ) => { ajaxError : { ( document : ( event : Event , xhr : { responseText : string ; status : number ; } , settings : { data : unknown ; url : string ; } , error : string ) => void ) : void ; } ; } ;
88
99export class BrowserGlobalHandlerPlugin implements IEventPlugin {
1010 public priority : number = 100 ;
@@ -28,7 +28,7 @@ export class BrowserGlobalHandlerPlugin implements IEventPlugin {
2828 let error = event . reason ;
2929 try {
3030 // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
31- const reason = ( < any > event ) . detail ?. reason ;
31+ const reason = ( < { detail ?: { reason : string } } > event ) . detail ?. reason ;
3232 if ( reason ) {
3333 error = reason ;
3434 }
@@ -62,7 +62,7 @@ export class BrowserGlobalHandlerPlugin implements IEventPlugin {
6262 private getError ( event : ErrorEvent ) : Error {
6363 const { error, message, filename, lineno, colno } = event ;
6464 if ( typeof error === "object" ) {
65- return error ;
65+ return error as Error ;
6666 }
6767
6868 let name : string = "Error" ;
@@ -71,7 +71,7 @@ export class BrowserGlobalHandlerPlugin implements IEventPlugin {
7171 const errorNameRegex : RegExp = / ^ (?: [ U u ] n c a u g h t (?: e x c e p t i o n : ) ? ) ? (?: ( (?: A g g r e g a t e | E v a l | I n t e r n a l | R a n g e | R e f e r e n c e | S y n t a x | T y p e | U R I | ) E r r o r ) : ) ? ( .* ) $ / i;
7272 const regexResult = errorNameRegex . exec ( msg ) ;
7373 if ( regexResult ) {
74- const [ _ , errorName , errorMessage ] = regexResult ;
74+ const [ , errorName , errorMessage ] = regexResult ;
7575 if ( errorName ) {
7676 name = errorName ;
7777 }
@@ -83,7 +83,7 @@ export class BrowserGlobalHandlerPlugin implements IEventPlugin {
8383
8484 const ex = new Error ( msg || "Script error." ) ;
8585 ex . name = name ;
86- ex . stack = `at ${ filename || "" } :${ ! isNaN ( lineno ) ? lineno : 0 } ${ ! isNaN ( colno ) ? ":" + colno : "" } ` ;
86+ ex . stack = `at ${ filename || "" } :${ ! isNaN ( lineno ) ? lineno : 0 } ${ ! isNaN ( colno ) ? `: ${ colno } ` : "" } ` ;
8787 return ex ;
8888 }
8989}
0 commit comments