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
23 lines
555 B
import {HTTPStatus, Message} from '../const/http.ts'
|
|
|
|
/**
|
|
* Error class representing an HTTP error.
|
|
* @extends Error
|
|
*/
|
|
export default class HTTPError extends Error {
|
|
constructor(
|
|
/**
|
|
* The associated HTTP status code.
|
|
* @type HTTPStatus
|
|
*/
|
|
public readonly http_status: HTTPStatus,
|
|
/**
|
|
* The associated message.
|
|
* @type string
|
|
*/
|
|
public readonly http_message?: string
|
|
) {
|
|
super(`HTTP ${http_status}: ${http_message || Message[http_status]}`)
|
|
}
|
|
}
|