Document HttpError

Also type the status.
This commit is contained in:
Asher 2020-11-05 17:07:51 -06:00
parent f7076247f9
commit 959497067c
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A

View File

@ -8,8 +8,12 @@ export enum HttpCode {
ServerError = 500, ServerError = 500,
} }
/**
* Represents an error with a message and an HTTP status code. This code will be
* used in the HTTP response.
*/
export class HttpError extends Error { export class HttpError extends Error {
public constructor(message: string, public readonly status: number, public readonly details?: object) { public constructor(message: string, public readonly status: HttpCode, public readonly details?: object) {
super(message) super(message)
this.name = this.constructor.name this.name = this.constructor.name
} }