@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.
@@ -50,5 +50,6 @@ export declare class NetworkRecorder {
50
50
  private truncateContent;
51
51
  private generateRequestId;
52
52
  private addCompletedRequest;
53
+ private isErrorRequest;
53
54
  }
54
55
  export {};
@@ -371,6 +371,20 @@ export class NetworkRecorder {
371
371
  }
372
372
  addCompletedRequest(requestId, request) {
373
373
  this.pendingRequests.delete(requestId);
374
- this.requestsBuffer.push(request);
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@affogatosoftware/recorder",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "license": "MIT",
5
5
  "author": "Chris Ryan",
6
6
  "main": "./dist/index.js",