Skip to content

Commit 9afaaf2

Browse files
refactor: report HTTP fetch errors as such
1 parent 666fb3a commit 9afaaf2

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

packages/binding-http/src/http-client-impl.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,9 @@ export default class HttpClient implements ProtocolClient {
433433
if (HttpClient.isOAuthTokenExpired(result, this.credential)) {
434434
this.credential = await (this.credential as OAuthCredential).refreshToken();
435435
return await this._fetch(await this.credential.sign(request));
436+
} else if (result.status >= 400) {
437+
// report generic error
438+
throw new Error(`request to ${request.url} failed, reason: HTTP status result ${result.status} `);
436439
}
437440

438441
return result;

0 commit comments

Comments
 (0)