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:
+5
-3
@@ -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,
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user