Skip to content

Commit 9594970

Browse files
committed
Document HttpError
Also type the status.
1 parent f707624 commit 9594970

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/common/http.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ export enum HttpCode {
88
ServerError = 500,
99
}
1010

11+
/**
12+
* Represents an error with a message and an HTTP status code. This code will be
13+
* used in the HTTP response.
14+
*/
1115
export class HttpError extends Error {
12-
public constructor(message: string, public readonly status: number, public readonly details?: object) {
16+
public constructor(message: string, public readonly status: HttpCode, public readonly details?: object) {
1317
super(message)
1418
this.name = this.constructor.name
1519
}

0 commit comments

Comments
 (0)