mirror of
https://github.com/mattermost/focalboard.git
synced 2025-01-08 15:06:08 +02:00
Refactor errorResponse to set the logger to debug if the response cod… (#2719)
* Refactor errorResponse to set the logger to debug if the response code is set to unauthorised. Fixes #2488 * Fix merge conflicts
This commit is contained in:
parent
2c067147e7
commit
263bd92424
@ -3873,12 +3873,21 @@ func (a *API) handleDeleteBoardsAndBlocks(w http.ResponseWriter, r *http.Request
|
||||
// Response helpers
|
||||
|
||||
func (a *API) errorResponse(w http.ResponseWriter, api string, code int, message string, sourceError error) {
|
||||
if code == http.StatusUnauthorized {
|
||||
a.logger.Debug("API DEBUG",
|
||||
mlog.Int("code", code),
|
||||
mlog.Err(sourceError),
|
||||
mlog.String("msg", message),
|
||||
mlog.String("api", api),
|
||||
)
|
||||
} else {
|
||||
a.logger.Error("API ERROR",
|
||||
mlog.Int("code", code),
|
||||
mlog.Err(sourceError),
|
||||
mlog.String("msg", message),
|
||||
mlog.String("api", api),
|
||||
)
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
data, err := json.Marshal(model.ErrorResponse{Error: message, ErrorCode: code})
|
||||
|
Loading…
Reference in New Issue
Block a user