From 959497067c32e265661f1d70c864e793b0e96084 Mon Sep 17 00:00:00 2001 From: Asher Date: Thu, 5 Nov 2020 17:07:51 -0600 Subject: [PATCH] Document HttpError Also type the status. --- src/common/http.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/http.ts b/src/common/http.ts index 5279bf44f..c08c8673b 100644 --- a/src/common/http.ts +++ b/src/common/http.ts @@ -8,8 +8,12 @@ export enum HttpCode { 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 { - 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) this.name = this.constructor.name }