@affogatosoftware/recorder 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -371,6 +371,20 @@ export class NetworkRecorder {
|
|
|
371
371
|
}
|
|
372
372
|
addCompletedRequest(requestId, request) {
|
|
373
373
|
this.pendingRequests.delete(requestId);
|
|
374
|
-
|
|
374
|
+
// Only record requests that are errors
|
|
375
|
+
if (this.isErrorRequest(request)) {
|
|
376
|
+
this.requestsBuffer.push(request);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
isErrorRequest(request) {
|
|
380
|
+
// Network/fetch errors (error field is populated)
|
|
381
|
+
if (request.error) {
|
|
382
|
+
return true;
|
|
383
|
+
}
|
|
384
|
+
// HTTP error status codes (4xx, 5xx)
|
|
385
|
+
if (request.responseStatus && request.responseStatus >= 400) {
|
|
386
|
+
return true;
|
|
387
|
+
}
|
|
388
|
+
return false;
|
|
375
389
|
}
|
|
376
390
|
}
|