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.

23 lines
555 B

4 years ago
import {HTTPStatus, Message} from '../const/http.ts'
4 years ago
/**
* Error class representing an HTTP error.
* @extends Error
*/
4 years ago
export default class HTTPError extends Error {
constructor(
4 years ago
/**
* The associated HTTP status code.
* @type HTTPStatus
*/
4 years ago
public readonly http_status: HTTPStatus,
4 years ago
/**
* The associated message.
* @type string
*/
4 years ago
public readonly http_message?: string
) {
super(`HTTP ${http_status}: ${http_message || Message[http_status]}`)
}
}