Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement better messages for request errors #1274

Merged
merged 2 commits into from Sep 14, 2023

Conversation

peaBerberian
Copy link
Collaborator

While debugging some issues, we noticed that our network-related error messages could do with more verbosity. This is what this PR does.

It also adds the HTTP status code in the message when this is the source, of the network error. Today it is only present as a status property.

@peaBerberian peaBerberian added this to the 3.31.1 milestone Sep 1, 2023
While debugging some issues, we noticed that our network-related error
messages could do with more verbosity. This is what this commit does.

It also adds the HTTP status code in the message when this is the
source, of the network error. Today it is only present as a `status`
property.

switch (type) {
case "TIMEOUT":
this.message = "The request timeouted";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better English would be

Suggested change
this.message = "The request timeouted";
this.message = "The request timed out";

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it does sound better :p!

Thanks!

@peaBerberian peaBerberian modified the milestones: 3.31.1, 3.32.0 Sep 12, 2023
@@ -50,7 +50,8 @@ describe("errors - NetworkError", () => {
expect(networkError.code).toBe("PIPELINE_LOAD_ERROR");
expect(networkError.fatal).toBe(true);
expect(networkError.message)
.toBe("NetworkError (PIPELINE_LOAD_ERROR) ERROR_HTTP_CODE");
.toBe("NetworkError (PIPELINE_LOAD_ERROR) An HTTP status code " +
"indicating failure was received: 13");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-existing issue in the test: 13 isn't a normal HTTP status code. I would expect, for example, 403.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@peaBerberian peaBerberian merged commit 07ba4d6 into master Sep 14, 2023
3 checks passed
@peaBerberian peaBerberian mentioned this pull request Oct 2, 2023
@peaBerberian peaBerberian deleted the misc/better-request-error-msg branch February 7, 2024 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants