HBHTTPResponseError

public protocol HBHTTPResponseError : Error

An error that is capable of generating an HTTP response

By conforming to HBHTTPResponseError you can control how your error will be presented to the client. Errors not conforming to this will be returned with status internalServerError.

  • status code for the error

    Declaration

    Swift

    var status: HTTPResponseStatus { get }
  • any addiitional headers required

    Declaration

    Swift

    var headers: HTTPHeaders { get }
  • return error payload.

    Declaration

    Swift

    func body(allocator: ByteBufferAllocator) -> ByteBuffer?
  • response(version:allocator:) Extension method

    Generate response from error

    Declaration

    Swift

    public func response(version: HTTPVersion, allocator: ByteBufferAllocator) -> HBHTTPResponse

    Parameters

    allocator

    Byte buffer allocator used to allocate message body

    Return Value

    Response