From 7d850d2129b0dc823c6608cdafcffb1f8173eecf Mon Sep 17 00:00:00 2001 From: Aras Abbasi Date: Thu, 11 Jul 2024 13:40:58 +0200 Subject: [PATCH] chore: improve comments (#445) Co-authored-by: wolfy1339 <4595477+wolfy1339@users.noreply.github.com> --- src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index ffda6b2..686f849 100644 --- a/src/index.ts +++ b/src/index.ts @@ -37,11 +37,11 @@ export class RequestError extends Error { this.name = "HttpError"; - // Implicit coercion to number if statusCode is a string + // Coerce the statusCode to an integer especially if it is a string this.status = Number.parseInt(statusCode as unknown as string); - // If status is not equal to itself, then it is NaN - // 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 if (Number.isNaN(this.status)) { this.status = 0; }