Improve error messages
Make clear that they come from the IP allocator, and reduce repetition in the text. Also include the nickname for other peer, if known.
This commit is contained in:
1 parent
cf34335ec7
commit
ee7dac9e28
4 files changed
+10
-6
No files matched your search
+2
-2
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
func badRequest(w http.ResponseWriter, err error) {
|
||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||
common.Warning.Println(err.Error())
|
||||
common.Warning.Println("[allocator]:", err.Error())
|
||||
}
|
||||
|
||||
// HandleHTTP wires up ipams HTTP endpoints to the provided mux.
|
||||
@@ -26,7 +26,7 @@ func (alloc *Allocator) HandleHTTP(router *mux.Router) {
|
||||
badRequest(w, err)
|
||||
return
|
||||
} else if err := alloc.Claim(ident, ip, closedChan); err != nil {
|
||||
badRequest(w, fmt.Errorf("Unable to claim IP address %s: %s", ip, err))
|
||||
badRequest(w, fmt.Errorf("Unable to claim: %s", err))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user