93
// status code based on the type of error.
94
// nolint:revive // Keeping all of the logic together for readability, even if it means the function is long.
95
>
func (h *BaseHTTPHandler) WriteFailure(writer http.ResponseWriter, r *http.Request, err error) {
server.go
96
>
var failure nexus.Failure
97
>
var failureError *nexus.FailureError
98
>
var opError *nexus.OperationError
99
>
var handlerError *nexus.HandlerError
100
>
var operationState nexus.OperationState
101
>
statusCode := http.StatusInternalServerError
102
>
103
>
if errors.As(err, &opError) {
105
>
var convErr error
106
>
failure, convErr = h.FailureConverter.ErrorToFailure(opError)
107
>
if convErr != nil {
108
h.Logger.Error("failed to convert operation error to failure", "error", convErr)
109
writer.WriteHeader(http.StatusInternalServerError)