fix(core): refine HttpError.status property type (#2890)

As this is property only ever has an error HTTP status code (>400).
This commit is contained in:
Asher Gomez
2025-06-16 17:57:49 +02:00
committed by GitHub
parent 71b7de4581
commit c3c79352b0
+5 -3
View File
@@ -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 * 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. * Constructs a new instance.
@@ -65,7 +67,7 @@ export class HttpError extends Error {
* @param options Optional error options. * @param options Optional error options.
*/ */
constructor( constructor(
status: keyof typeof STATUS_TEXT, status: ErrorStatus,
message: string = STATUS_TEXT[status], message: string = STATUS_TEXT[status],
options?: ErrorOptions, options?: ErrorOptions,
) { ) {