func (f *FailureResponseBuilder) WithErrorKey(errorKey string) *FailureResponseBuilder {
	f.errorKey = errorKey
	return f
}
WithErrorKey adds a custom ErrorKey which will be used in FailureResponse to add an `Error`
field to the JSON HTTP response body
package apiresponses
import (
	"fmt"
	"net/http"
	"code.cloudfoundry.org/lager"
)
type FailureResponse struct {
	error
	statusCode    int
	loggerAction  string
	emptyResponse bool
	errorKey      string
}
func NewFailureResponse(err error, statusCode int, loggerAction string) *FailureResponse {
	return &FailureResponse{
		error:        err,
		statusCode:   statusCode,
		loggerAction: loggerAction,
	}
}
func (f *FailureResponse) ErrorResponse() interface{} {
	if f.emptyResponse {
		return EmptyResponse{}
	}
	return ErrorResponse{
		Description: f.error.Error(),
		Error:       f.errorKey,
	}
}
func (f *FailureResponse) ValidatedStatusCode(logger lager.Logger) int {
	if f.statusCode < 400 || 600 <= f.statusCode {
		if logger != nil {
			logger.Error("validating-status-code", fmt.Errorf("Invalid failure http response code: 600, expected 4xx or 5xx, returning internal server error: 500."))
		}
		return http.StatusInternalServerError
	}
	return f.statusCode
}
func (f *FailureResponse) LoggerAction() string {
	return f.loggerAction
}
func (f *FailureResponse) AppendErrorMessage(msg string) *FailureResponse {
	return &FailureResponse{
		error:         fmt.Errorf("%s %s", f.Error(), msg),
		statusCode:    f.statusCode,
		loggerAction:  f.loggerAction,
		emptyResponse: f.emptyResponse,
		errorKey:      f.errorKey,
	}
}
type FailureResponseBuilder struct {
	error
	statusCode    int
	loggerAction  string
	emptyResponse bool
	errorKey      string
}
func NewFailureResponseBuilder(err error, statusCode int, loggerAction string) *FailureResponseBuilder {
	return &FailureResponseBuilder{
		error:         err,
		statusCode:    statusCode,
		loggerAction:  loggerAction,
		emptyResponse: false,
	}
}