Fix logging

This commit is contained in:
Till Faelligen 2023-05-23 18:06:47 +02:00
parent 1a178473c7
commit a0e256711d
No known key found for this signature in database
GPG key ID: ACCDC9606D472758
2 changed files with 7 additions and 7 deletions

View file

@ -162,13 +162,13 @@ func MakeJoin(
switch e := internalErr.(type) {
case nil:
case spec.InternalServerError:
util.GetLogger(httpReq.Context()).WithError(internalErr)
util.GetLogger(httpReq.Context()).WithError(internalErr).Error("failed to handle make_join request")
return util.JSONResponse{
Code: http.StatusInternalServerError,
JSON: spec.InternalServerError{},
}
case spec.MatrixError:
util.GetLogger(httpReq.Context()).WithError(internalErr)
util.GetLogger(httpReq.Context()).WithError(internalErr).Error("failed to handle make_join request")
code := http.StatusInternalServerError
switch e.ErrCode {
case spec.ErrorForbidden:
@ -186,13 +186,13 @@ func MakeJoin(
JSON: e,
}
case spec.IncompatibleRoomVersionError:
util.GetLogger(httpReq.Context()).WithError(internalErr)
util.GetLogger(httpReq.Context()).WithError(internalErr).Error("failed to handle make_join request")
return util.JSONResponse{
Code: http.StatusBadRequest,
JSON: e,
}
default:
util.GetLogger(httpReq.Context()).WithError(internalErr)
util.GetLogger(httpReq.Context()).WithError(internalErr).Error("failed to handle make_join request")
return util.JSONResponse{
Code: http.StatusBadRequest,
JSON: spec.Unknown("unknown error"),

View file

@ -101,13 +101,13 @@ func MakeLeave(
switch e := internalErr.(type) {
case nil:
case spec.InternalServerError:
util.GetLogger(httpReq.Context()).WithError(internalErr)
util.GetLogger(httpReq.Context()).WithError(internalErr).Error("failed to handle make_leave request")
return util.JSONResponse{
Code: http.StatusInternalServerError,
JSON: spec.InternalServerError{},
}
case spec.MatrixError:
util.GetLogger(httpReq.Context()).WithError(internalErr)
util.GetLogger(httpReq.Context()).WithError(internalErr).Error("failed to handle make_leave request")
code := http.StatusInternalServerError
switch e.ErrCode {
case spec.ErrorForbidden:
@ -123,7 +123,7 @@ func MakeLeave(
JSON: e,
}
default:
util.GetLogger(httpReq.Context()).WithError(internalErr)
util.GetLogger(httpReq.Context()).WithError(internalErr).Error("failed to handle make_leave request")
return util.JSONResponse{
Code: http.StatusBadRequest,
JSON: spec.Unknown("unknown error"),