Skip to content
Snippets Groups Projects
Commit bef0bea2 authored by ale's avatar ale
Browse files

Improve logging for exchange failures

parent d3b43e35
No related branches found
No related tags found
No related merge requests found
......@@ -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
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment