You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
518 B
18 lines
518 B
import {ErrorWithContext, HTTPStatus, HTTPMessage} from "@extollo/util"
|
|
|
|
/**
|
|
* An error class that has an associated HTTP status.
|
|
*
|
|
* When thrown inside the request lifecycle, this will result in the HTTP
|
|
* status code being applied to the response.
|
|
*/
|
|
export class HTTPError extends ErrorWithContext {
|
|
constructor(
|
|
public readonly status: HTTPStatus = 500,
|
|
public readonly message: string = ''
|
|
) {
|
|
super('HTTP ERROR')
|
|
this.message = message || HTTPMessage[status]
|
|
}
|
|
}
|