Skip to content

Commit

Permalink
fix: 🐛 error message missing status in http2
Browse files Browse the repository at this point in the history
In HTTP2, statusText is empty. This results in half of the error message
missing. Also, the error message is more human-readable now.
  • Loading branch information
Gregofi authored and mjancarik committed Jan 7, 2025
1 parent 7237693 commit 181302a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/plugin-http-client/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,12 @@ function httpClientAPI() {
);

if (!response.ok) {
const error = new Error(`${response.statusText}: ${request.url}`, {
cause: { request, response },
});
const error = new Error(
`Received ${response.status} status code when requesting ${request.url}`,
{
cause: { request, response },
},
);
// keep compatablity
error.request = request;
error.response = response;
Expand Down

0 comments on commit 181302a

Please sign in to comment.