Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.36.0 (六月 06, 2025)

- fix: throw original error in pRetry

## 0.35.1 (六月 05, 2025)

- feat: always retry for 5xx errors
Expand Down
17 changes: 11 additions & 6 deletions packages/sdk-util/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,18 +320,23 @@ class BaseClient {
message = `GraphQLError: ${message}`;
}

const err = res.status >= 500 ? new Error(message) : new pRetry.AbortError(message);
err.errors = json.errors;
err.status = res.status;
const originalError = new Error(message);
originalError.errors = json.errors;
originalError.status = res.status;

const err = res.status >= 500 ? originalError : new pRetry.AbortError(originalError);
throw err;
}

// Handle HTTP errors
if (res.status !== 200) {
const message = json.error || json.message || `GraphQL Status Error ${res.status}`;
const err = res.status >= 500 ? new Error(message) : new pRetry.AbortError(message);
err.status = res.status;
err.response = json;

const originalError = new Error(message);
originalError.status = res.status;
originalError.response = json;

const err = res.status >= 500 ? originalError : new pRetry.AbortError(originalError);
throw err;
}

Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.35.1
0.36.0
Loading