Commit bef0bea2 authored by ale's avatar ale

Improve logging for exchange failures

parent d3b43e35
Pipeline #1423 passed with stages
in 1 minute and 53 seconds
......@@ -290,8 +290,13 @@ func (h *Server) handleExchange(w http.ResponseWriter, req *http.Request) {
reqGroups := strings.Split(req.FormValue("new_groups"), ",")
token, err := h.loginService.Exchange(curToken, curService, curNonce, newService, newNonce, reqGroups)
if err != nil {
log.Printf("exchange error: %v", err)
switch {
case err == ErrUnauthorized:
log.Printf("unauthorized exchange request (%s -> %s)", curService, newService)
http.Error(w, "Forbidden", http.StatusForbidden)
return
case err != nil:
log.Printf("exchange error (%s -> %s): %v", curService, newService, err)
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment