@dereekb/util 12.1.1 → 12.1.2

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.
@@ -5877,7 +5877,8 @@ function rateLimitedFetchHandler(config) {
5877
5877
  fetchResponseError = e;
5878
5878
  response = fetchResponseError.response;
5879
5879
  }
5880
- const shouldRetry = await updateWithResponse(response, fetchResponseError);
5880
+ // response could be null in some cases
5881
+ const shouldRetry = response ? await updateWithResponse(response, fetchResponseError) : false;
5881
5882
  if (shouldRetry && retriesAttempted < maxRetries) {
5882
5883
  response = await tryFetch(retriesAttempted + 1);
5883
5884
  } else {
@@ -5886,6 +5887,10 @@ function rateLimitedFetchHandler(config) {
5886
5887
  throw fetchResponseError;
5887
5888
  }
5888
5889
  }
5890
+ // if response is null at this point but fetchResponseError is not, rethrow the error
5891
+ if (response == null && fetchResponseError != null) {
5892
+ throw fetchResponseError;
5893
+ }
5889
5894
  return response;
5890
5895
  }
5891
5896
  return tryFetch(0);
@@ -5875,7 +5875,8 @@ function rateLimitedFetchHandler(config) {
5875
5875
  fetchResponseError = e;
5876
5876
  response = fetchResponseError.response;
5877
5877
  }
5878
- const shouldRetry = await updateWithResponse(response, fetchResponseError);
5878
+ // response could be null in some cases
5879
+ const shouldRetry = response ? await updateWithResponse(response, fetchResponseError) : false;
5879
5880
  if (shouldRetry && retriesAttempted < maxRetries) {
5880
5881
  response = await tryFetch(retriesAttempted + 1);
5881
5882
  } else {
@@ -5884,6 +5885,10 @@ function rateLimitedFetchHandler(config) {
5884
5885
  throw fetchResponseError;
5885
5886
  }
5886
5887
  }
5888
+ // if response is null at this point but fetchResponseError is not, rethrow the error
5889
+ if (response == null && fetchResponseError != null) {
5890
+ throw fetchResponseError;
5891
+ }
5887
5892
  return response;
5888
5893
  }
5889
5894
  return tryFetch(0);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util/fetch",
3
- "version": "12.1.1",
3
+ "version": "12.1.2",
4
4
  ".": {
5
5
  "types": "./src/index.d.ts",
6
6
  "node": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util",
3
- "version": "12.1.1",
3
+ "version": "12.1.2",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./src/index.d.ts",
package/test/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [12.1.2](https://github.com/dereekb/dbx-components/compare/v12.1.1-dev...v12.1.2) (2025-05-13)
6
+
7
+
8
+
5
9
  ## [12.1.1](https://github.com/dereekb/dbx-components/compare/v12.1.0-dev...v12.1.1) (2025-05-12)
6
10
 
7
11
 
package/test/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util/test",
3
- "version": "12.1.1",
3
+ "version": "12.1.2",
4
4
  "type": "commonjs",
5
5
  "peerDependencies": {
6
6
  "@dereekb/util": "*"