code-server/src/common/http.ts
2020-07-29 18:48:05 -05:00

17 lines
365 B
TypeScript

export enum HttpCode {
Ok = 200,
Redirect = 302,
NotFound = 404,
BadRequest = 400,
Unauthorized = 401,
LargePayload = 413,
ServerError = 500,
}
export class HttpError extends Error {
public constructor(message: string, public readonly code: number, public readonly details?: object) {
super(message)
this.name = this.constructor.name
}
}