We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e24d923 commit 7d850d2Copy full SHA for 7d850d2
src/index.ts
@@ -37,11 +37,11 @@ export class RequestError extends Error {
37
38
this.name = "HttpError";
39
40
- // Implicit coercion to number if statusCode is a string
+ // Coerce the statusCode to an integer especially if it is a string
41
this.status = Number.parseInt(statusCode as unknown as string);
42
43
- // If status is not equal to itself, then it is NaN
44
- // we set then the status to 0
+ // If status code is NaN, then set status to 0 to signal e.g. a network
+ // error or a AbortError
45
if (Number.isNaN(this.status)) {
46
this.status = 0;
47
}
0 commit comments