Add basic response factories and helpers
This commit is contained in:
11
src/http/HTTPError.ts
Normal file
11
src/http/HTTPError.ts
Normal 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]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user