@@ -98,19 +98,21 @@ export default function windowFetch(options: CustomOptionsType, segments: Segmen
9898 . json ( )
9999 . then ( ( body : any ) => body )
100100 . catch ( ( err : any ) => err ) ;
101- const logInfo = {
102- uniqueId : uuid ( ) ,
103- service : options . service ,
104- serviceVersion : options . serviceVersion ,
105- pagePath : options . pagePath ,
106- category : ErrorsCategory . AJAX_ERROR ,
107- grade : GradeTypeEnum . ERROR ,
108- errorUrl : response . url || location . href ,
109- message : `status: ${ response . status } ; statusText: ${ response . statusText } ;` ,
110- collector : options . collector ,
111- stack : 'Fetch: ' + response . statusText ,
112- } ;
113- new Base ( ) . traceInfo ( logInfo ) ;
101+ if ( response . status === 0 || response . status >= 400 ) {
102+ const logInfo = {
103+ uniqueId : uuid ( ) ,
104+ service : options . service ,
105+ serviceVersion : options . serviceVersion ,
106+ pagePath : options . pagePath ,
107+ category : ErrorsCategory . AJAX_ERROR ,
108+ grade : GradeTypeEnum . ERROR ,
109+ errorUrl : response . url || location . href ,
110+ message : `status: ${ response . status } ; statusText: ${ response . statusText } ;` ,
111+ collector : options . collector ,
112+ stack : 'Fetch: ' + response . statusText ,
113+ } ;
114+ new Base ( ) . traceInfo ( logInfo ) ;
115+ }
114116 if ( hasTrace ) {
115117 const endTime = new Date ( ) . getTime ( ) ;
116118 const exitSpan : SpanFields = {
0 commit comments