Add basic response factories and helpers

This commit is contained in:
2021-03-08 10:07:10 -06:00
parent 3acc1bc83e
commit a9ffa771dc
15 changed files with 365 additions and 10 deletions

11
src/http/HTTPError.ts Normal file
View File

@@ -0,0 +1,11 @@
import {ErrorWithContext, HTTPStatus, HTTPMessage} from "@extollo/util"
export class HTTPError extends ErrorWithContext {
constructor(
public readonly status: HTTPStatus = 500,
public readonly message: string = ''
) {
super(message || HTTPMessage[status])
this.message = message || HTTPMessage[status]
}
}