@types/http-errors

  • Version 1.8.2
  • Published
  • 6.72 kB
  • No dependencies
  • MIT license

Install

npm i @types/http-errors
yarn add @types/http-errors
pnpm add @types/http-errors

Overview

TypeScript definitions for http-errors

Index

Variables

variable createHttpError

const createHttpError: createHttpError.CreateHttpError & {
[code: string]: createHttpError.HttpErrorConstructor<number>;
HttpError: createHttpError.HttpErrorConstructor<number>;
} & Record<'BadRequest' | '400', createHttpError.HttpErrorConstructor<400>> &
Record<'Unauthorized' | '401', createHttpError.HttpErrorConstructor<401>> &
Record<'PaymentRequired' | '402', createHttpError.HttpErrorConstructor<402>> &
Record<'Forbidden' | '403', createHttpError.HttpErrorConstructor<403>> &
Record<'NotFound' | '404', createHttpError.HttpErrorConstructor<404>> &
Record<'MethodNotAllowed' | '405', createHttpError.HttpErrorConstructor<405>> &
Record<'NotAcceptable' | '406', createHttpError.HttpErrorConstructor<406>> &
Record<
'ProxyAuthenticationRequired' | '407',
createHttpError.HttpErrorConstructor<407>
> &
Record<'RequestTimeout' | '408', createHttpError.HttpErrorConstructor<408>> &
Record<'Conflict' | '409', createHttpError.HttpErrorConstructor<409>> &
Record<'Gone' | '410', createHttpError.HttpErrorConstructor<410>> &
Record<'LengthRequired' | '411', createHttpError.HttpErrorConstructor<411>> &
Record<'PreconditionFailed' | '412', createHttpError.HttpErrorConstructor<412>> &
Record<'PayloadTooLarge' | '413', createHttpError.HttpErrorConstructor<413>> &
Record<'URITooLong' | '414', createHttpError.HttpErrorConstructor<414>> &
Record<
'UnsupportedMediaType' | '415',
createHttpError.HttpErrorConstructor<415>
> &
Record<
'RangeNotSatisfiable' | '416',
createHttpError.HttpErrorConstructor<416>
> &
Record<'ExpectationFailed' | '417', createHttpError.HttpErrorConstructor<417>> &
Record<'ImATeapot' | '418', createHttpError.HttpErrorConstructor<418>> &
Record<'MisdirectedRequest' | '421', createHttpError.HttpErrorConstructor<421>> &
Record<
'UnprocessableEntity' | '422',
createHttpError.HttpErrorConstructor<422>
> &
Record<'Locked' | '423', createHttpError.HttpErrorConstructor<423>> &
Record<'FailedDependency' | '424', createHttpError.HttpErrorConstructor<424>> &
Record<
'UnorderedCollection' | '425',
createHttpError.HttpErrorConstructor<425>
> &
Record<'UpgradeRequired' | '426', createHttpError.HttpErrorConstructor<426>> &
Record<
'PreconditionRequired' | '428',
createHttpError.HttpErrorConstructor<428>
> &
Record<'TooManyRequests' | '429', createHttpError.HttpErrorConstructor<429>> &
Record<
'RequestHeaderFieldsTooLarge' | '431',
createHttpError.HttpErrorConstructor<431>
> &
Record<
'UnavailableForLegalReasons' | '451',
createHttpError.HttpErrorConstructor<451>
> &
Record<
'InternalServerError' | '500',
createHttpError.HttpErrorConstructor<500>
> &
Record<'NotImplemented' | '501', createHttpError.HttpErrorConstructor<501>> &
Record<'BadGateway' | '502', createHttpError.HttpErrorConstructor<502>> &
Record<'ServiceUnavailable' | '503', createHttpError.HttpErrorConstructor<500>> &
Record<'GatewayTimeout' | '504', createHttpError.HttpErrorConstructor<504>> &
Record<
'HTTPVersionNotSupported' | '505',
createHttpError.HttpErrorConstructor<505>
> &
Record<
'VariantAlsoNegotiates' | '506',
createHttpError.HttpErrorConstructor<506>
> &
Record<
'InsufficientStorage' | '507',
createHttpError.HttpErrorConstructor<507>
> &
Record<'LoopDetected' | '508', createHttpError.HttpErrorConstructor<508>> &
Record<
'BandwidthLimitExceeded' | '509',
createHttpError.HttpErrorConstructor<509>
> &
Record<'NotExtended' | '510', createHttpError.HttpErrorConstructor<510>> &
Record<
'NetworkAuthenticationRequire' | '511',
createHttpError.HttpErrorConstructor<511>
> & { isHttpError: createHttpError.IsHttpError };

    Interfaces

    interface HttpError

    interface HttpError<N extends number = number> extends Error {}

      property expose

      expose: boolean;

        property headers

        headers?:
        | {
        [key: string]: string;
        }
        | undefined;

          property status

          status: N;

            property statusCode

            statusCode: N;

              index signature

              [key: string]: any;

                Type Aliases

                type CreateHttpError

                type CreateHttpError = <N extends UnknownError>(
                arg: N,
                ...rest: UnknownError[]
                ) => HttpError<N extends number ? N : number>;

                  type HttpErrorConstructor

                  type HttpErrorConstructor<N extends number = number> = new (
                  msg?: string
                  ) => HttpError<N>;

                    type IsHttpError

                    type IsHttpError = (error: unknown) => error is HttpError;

                      type NamedConstructors

                      type NamedConstructors = {
                      [code: string]: HttpErrorConstructor;
                      HttpError: HttpErrorConstructor;
                      } & Record<'BadRequest' | '400', HttpErrorConstructor<400>> &
                      Record<'Unauthorized' | '401', HttpErrorConstructor<401>> &
                      Record<'PaymentRequired' | '402', HttpErrorConstructor<402>> &
                      Record<'Forbidden' | '403', HttpErrorConstructor<403>> &
                      Record<'NotFound' | '404', HttpErrorConstructor<404>> &
                      Record<'MethodNotAllowed' | '405', HttpErrorConstructor<405>> &
                      Record<'NotAcceptable' | '406', HttpErrorConstructor<406>> &
                      Record<'ProxyAuthenticationRequired' | '407', HttpErrorConstructor<407>> &
                      Record<'RequestTimeout' | '408', HttpErrorConstructor<408>> &
                      Record<'Conflict' | '409', HttpErrorConstructor<409>> &
                      Record<'Gone' | '410', HttpErrorConstructor<410>> &
                      Record<'LengthRequired' | '411', HttpErrorConstructor<411>> &
                      Record<'PreconditionFailed' | '412', HttpErrorConstructor<412>> &
                      Record<'PayloadTooLarge' | '413', HttpErrorConstructor<413>> &
                      Record<'URITooLong' | '414', HttpErrorConstructor<414>> &
                      Record<'UnsupportedMediaType' | '415', HttpErrorConstructor<415>> &
                      Record<'RangeNotSatisfiable' | '416', HttpErrorConstructor<416>> &
                      Record<'ExpectationFailed' | '417', HttpErrorConstructor<417>> &
                      Record<'ImATeapot' | '418', HttpErrorConstructor<418>> &
                      Record<'MisdirectedRequest' | '421', HttpErrorConstructor<421>> &
                      Record<'UnprocessableEntity' | '422', HttpErrorConstructor<422>> &
                      Record<'Locked' | '423', HttpErrorConstructor<423>> &
                      Record<'FailedDependency' | '424', HttpErrorConstructor<424>> &
                      Record<'UnorderedCollection' | '425', HttpErrorConstructor<425>> &
                      Record<'UpgradeRequired' | '426', HttpErrorConstructor<426>> &
                      Record<'PreconditionRequired' | '428', HttpErrorConstructor<428>> &
                      Record<'TooManyRequests' | '429', HttpErrorConstructor<429>> &
                      Record<'RequestHeaderFieldsTooLarge' | '431', HttpErrorConstructor<431>> &
                      Record<'UnavailableForLegalReasons' | '451', HttpErrorConstructor<451>> &
                      Record<'InternalServerError' | '500', HttpErrorConstructor<500>> &
                      Record<'NotImplemented' | '501', HttpErrorConstructor<501>> &
                      Record<'BadGateway' | '502', HttpErrorConstructor<502>> &
                      Record<'ServiceUnavailable' | '503', HttpErrorConstructor<500>> &
                      Record<'GatewayTimeout' | '504', HttpErrorConstructor<504>> &
                      Record<'HTTPVersionNotSupported' | '505', HttpErrorConstructor<505>> &
                      Record<'VariantAlsoNegotiates' | '506', HttpErrorConstructor<506>> &
                      Record<'InsufficientStorage' | '507', HttpErrorConstructor<507>> &
                      Record<'LoopDetected' | '508', HttpErrorConstructor<508>> &
                      Record<'BandwidthLimitExceeded' | '509', HttpErrorConstructor<509>> &
                      Record<'NotExtended' | '510', HttpErrorConstructor<510>> &
                      Record<'NetworkAuthenticationRequire' | '511', HttpErrorConstructor<511>>;

                        type UnknownError

                        type UnknownError = Error | string | number | { [key: string]: any };

                          Package Files (1)

                          Dependencies (0)

                          No dependencies.

                          Dev Dependencies (0)

                          No dev dependencies.

                          Peer Dependencies (0)

                          No peer dependencies.

                          Badge

                          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/http-errors.

                          • Markdown
                            [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/http-errors)
                          • HTML
                            <a href="https://www.jsdocs.io/package/@types/http-errors"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>