Skip to content

Commit

Permalink
Use better english for RequestError linked to a Timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
peaBerberian committed Sep 12, 2023
1 parent 982f912 commit c161a5b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/errors/__tests__/network_error.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("errors - NetworkError", () => {
expect(networkError.code).toBe("PIPELINE_LOAD_ERROR");
expect(networkError.fatal).toBe(false);
expect(networkError.message)
.toBe("NetworkError (PIPELINE_LOAD_ERROR) TIMEOUT");
.toBe("NetworkError (PIPELINE_LOAD_ERROR) The request timed out");
});

it("should filter in a valid error code", () => {
Expand All @@ -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");
});

it("should return false in isHttpError if not an HTTP error", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/errors/__tests__/request_error.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ describe("errors - RequestError", () => {
expect(requestError.xhr).toBe(undefined);
expect(requestError.status).toBe(355);
expect(requestError.type).toBe("TIMEOUT");
expect(requestError.message).toBe("The request timeouted");
expect(requestError.message).toBe("The request timed out");
});
});
2 changes: 1 addition & 1 deletion src/errors/request_error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class RequestError extends Error {

switch (type) {
case "TIMEOUT":
this.message = "The request timeouted";
this.message = "The request timed out";
break;
case "ERROR_EVENT":
this.message = "An error prevented the request to be performed successfully";
Expand Down

0 comments on commit c161a5b

Please sign in to comment.