From c3c79352b062a3d43afa6bc5d833c5bd12d2a334 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Tue, 17 Jun 2025 01:57:49 +1000 Subject: [PATCH] fix(core): refine `HttpError.status` property type (#2890) As this is property only ever has an error HTTP status code (>400). --- src/error.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/error.ts b/src/error.ts index 610b09ba..1851113f 100644 --- a/src/error.ts +++ b/src/error.ts @@ -1,4 +1,6 @@ -import { STATUS_TEXT } from "@std/http/status"; +import { type ErrorStatus, STATUS_TEXT } from "@std/http/status"; + +export type { ErrorStatus }; /** * Error that's thrown when a request fails. Correlates to a @@ -54,7 +56,7 @@ export class HttpError extends Error { * } * ``` */ - status: number; + status: ErrorStatus; /** * Constructs a new instance. @@ -65,7 +67,7 @@ export class HttpError extends Error { * @param options Optional error options. */ constructor( - status: keyof typeof STATUS_TEXT, + status: ErrorStatus, message: string = STATUS_TEXT[status], options?: ErrorOptions, ) {