@@ -29,23 +29,23 @@ export const ERROR_INSTRUMENTATION_VERSION = '1';
2929export class HyperDXErrorInstrumentation extends InstrumentationBase {
3030 private readonly _consoleErrorHandler = ( original : Console [ 'error' ] ) => {
3131 return ( ...args : any [ ] ) => {
32- this . report ( 'console.error' , args ) ;
32+ this . hdxReport ( 'console.error' , args ) ;
3333 return original . apply ( this , args ) ;
3434 } ;
3535 } ;
3636
3737 private readonly _unhandledRejectionListener = (
3838 event : PromiseRejectionEvent ,
3939 ) => {
40- this . report ( 'unhandledrejection' , event . reason ) ;
40+ this . hdxReport ( 'unhandledrejection' , event . reason ) ;
4141 } ;
4242
4343 private readonly _errorListener = ( event : ErrorEvent ) => {
44- this . report ( 'onerror' , event ) ;
44+ this . hdxReport ( 'onerror' , event ) ;
4545 } ;
4646
4747 private readonly _documentErrorListener = ( event : ErrorEvent ) => {
48- this . report ( 'eventListener.error' , event ) ;
48+ this . hdxReport ( 'eventListener.error' , event ) ;
4949 } ;
5050
5151 constructor ( config : InstrumentationConfig ) {
@@ -83,7 +83,7 @@ export class HyperDXErrorInstrumentation extends InstrumentationBase {
8383 ) ;
8484 }
8585
86- protected reportError ( source : string , err : Error ) : void {
86+ protected hdxReportError ( source : string , err : Error ) : void {
8787 const msg = err . message || err . toString ( ) ;
8888 if ( ! useful ( msg ) && ! err . stack ) {
8989 return ;
@@ -92,7 +92,7 @@ export class HyperDXErrorInstrumentation extends InstrumentationBase {
9292 recordException ( err , { } , this . tracer ) ;
9393 }
9494
95- protected reportString (
95+ protected hdxReportString (
9696 source : string ,
9797 message : string ,
9898 firstError ?: Error ,
@@ -109,15 +109,15 @@ export class HyperDXErrorInstrumentation extends InstrumentationBase {
109109 recordException ( e , { } , this . tracer ) ;
110110 }
111111
112- protected reportErrorEvent ( source : string , ev : ErrorEvent ) : void {
112+ protected hdxReportErrorEvent ( source : string , ev : ErrorEvent ) : void {
113113 if ( ev . error ) {
114- this . report ( source , ev . error ) ;
114+ this . hdxReport ( source , ev . error ) ;
115115 } else if ( ev . message ) {
116- this . report ( source , ev . message ) ;
116+ this . hdxReport ( source , ev . message ) ;
117117 }
118118 }
119119
120- protected reportEvent ( source : string , ev : Event ) : void {
120+ protected hdxReportEvent ( source : string , ev : Event ) : void {
121121 // FIXME consider other sources of global 'error' DOM callback - what else can be captured here?
122122 if ( ! ev . target && ! useful ( ev . type ) ) {
123123 return ;
@@ -136,7 +136,7 @@ export class HyperDXErrorInstrumentation extends InstrumentationBase {
136136 recordException ( ev , { } , this . tracer , span ) ;
137137 }
138138
139- public report (
139+ protected hdxReport (
140140 source : string ,
141141 arg : string | Event | ErrorEvent | Array < any > ,
142142 ) : void {
@@ -147,23 +147,23 @@ export class HyperDXErrorInstrumentation extends InstrumentationBase {
147147 arg = arg [ 0 ] ;
148148 }
149149 if ( arg instanceof Error ) {
150- this . reportError ( source , arg ) ;
150+ this . hdxReportError ( source , arg ) ;
151151 } else if ( arg instanceof ErrorEvent ) {
152- this . reportErrorEvent ( source , arg ) ;
152+ this . hdxReportErrorEvent ( source , arg ) ;
153153 } else if ( arg instanceof Event ) {
154- this . reportEvent ( source , arg ) ;
154+ this . hdxReportEvent ( source , arg ) ;
155155 } else if ( typeof arg === 'string' ) {
156- this . reportString ( source , arg ) ;
156+ this . hdxReportString ( source , arg ) ;
157157 } else if ( arg instanceof Array ) {
158158 // if any arguments are Errors then add the stack trace even though the message is handled differently
159159 const firstError = arg . find ( ( x ) => x instanceof Error ) ;
160- this . reportString (
160+ this . hdxReportString (
161161 source ,
162162 arg . map ( ( x ) => stringifyValue ( x ) ) . join ( ' ' ) ,
163163 firstError ,
164164 ) ;
165165 } else {
166- this . reportString ( source , stringifyValue ( arg ) ) ; // FIXME or JSON.stringify?
166+ this . hdxReportString ( source , stringifyValue ( arg ) ) ; // FIXME or JSON.stringify?
167167 }
168168 }
169169}
0 commit comments