Function generateHttpErrorClass

  • Generates a new HttpError class with the given status code and name. In general, status codes are used to uniquely identify error types, so there should be no 2 classes with the same value there.

    To make sure Components.js can work with these newly generated classes, the generated class should be called BaseHttpError as that name is an entry in .componentsignore. The actual class should then extend BaseHttpError and have a correct constructor, so the Components.js generator can generate the correct components JSON-LD file during build.

    Type Parameters

    • TCode extends number


    • statusCode: TCode
    • name: string

    Returns HttpErrorClass<TCode>