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.
lib/src/http/response/HTTPErrorResponseFactory.ts

17 lines
616 B

import {ErrorResponseFactory} from "./ErrorResponseFactory";
import {HTTPError} from "../HTTPError";
import {HTTPStatus} from "@extollo/util"
export function http(status: HTTPStatus, message?: string, output: 'json' | 'html' | 'auto' = 'auto'): HTTPErrorResponseFactory {
return new HTTPErrorResponseFactory(new HTTPError(status, message), output)
}
export class HTTPErrorResponseFactory extends ErrorResponseFactory {
constructor(
public readonly error: HTTPError,
output: 'json' | 'html' | 'auto' = 'auto', // FIXME xml support
) {
super(error, error.status, output)
}
}