Skip to content

Commit ca6cfbc

Browse files
fix: ensure retried requests go through full error handling and parsing (#135)
When a 401 error occurs and the token is refreshed, the retry request was bypassing all error handling (403, 404, etc.) and JSON parsing by returning early. This fix ensures the retried response flows through the same error checking and parsing logic as the initial request. Changes: - Changed `response` from const to let to allow reassignment - Changed retry logic to reassign response instead of returning early 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
1 parent 7bc3853 commit ca6cfbc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/graph-client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class GraphClient {
5454
}
5555

5656
try {
57-
const response = await this.performRequest(endpoint, accessToken, options);
57+
let response = await this.performRequest(endpoint, accessToken, options);
5858

5959
if (response.status === 401 && refreshToken) {
6060
// Token expired, try to refresh
@@ -67,7 +67,7 @@ class GraphClient {
6767
}
6868

6969
// Retry the request with new token
70-
return this.performRequest(endpoint, accessToken, options);
70+
response = await this.performRequest(endpoint, accessToken, options);
7171
}
7272

7373
if (response.status === 403) {

0 commit comments

Comments
 (0)