All printed warnings should have some context

This commit is contained in:
Jakob Borg 2014-08-17 10:28:36 +02:00
parent d20df12168
commit 1a66461e07
4 changed files with 8 additions and 8 deletions

View File

@ -278,7 +278,7 @@ func restPostConfig(m *model.Model, w http.ResponseWriter, r *http.Request) {
var newCfg config.Configuration
err := json.NewDecoder(r.Body).Decode(&newCfg)
if err != nil {
l.Warnln(err)
l.Warnln("decoding posted config:", err)
http.Error(w, err.Error(), 500)
return
} else {
@ -289,7 +289,7 @@ func restPostConfig(m *model.Model, w http.ResponseWriter, r *http.Request) {
} else {
hash, err := bcrypt.GenerateFromPassword([]byte(newCfg.GUI.Password), 0)
if err != nil {
l.Warnln(err)
l.Warnln("bcrypting password:", err)
http.Error(w, err.Error(), 500)
return
} else {
@ -513,7 +513,7 @@ func restGetLang(w http.ResponseWriter, r *http.Request) {
func restPostUpgrade(w http.ResponseWriter, r *http.Request) {
rel, err := upgrade.LatestRelease(strings.Contains(Version, "-beta"))
if err != nil {
l.Warnln(err)
l.Warnln("getting latest release:", err)
http.Error(w, err.Error(), 500)
return
}
@ -521,7 +521,7 @@ func restPostUpgrade(w http.ResponseWriter, r *http.Request) {
if upgrade.CompareVersions(rel.Tag, Version) == 1 {
err = upgrade.UpgradeTo(rel, GoArchExtra)
if err != nil {
l.Warnln(err)
l.Warnln("upgrading:", err)
http.Error(w, err.Error(), 500)
return
}

View File

@ -79,7 +79,7 @@ func trackCPUUsage() {
for _ = range time.NewTicker(time.Second).C {
err := solarisPrusage(pid, &rusage)
if err != nil {
l.Warnln(err)
l.Warnln("getting prusage:", err)
continue
}
curTime := time.Now().UnixNano()

View File

@ -315,7 +315,7 @@ func Load(rd io.Reader, myID protocol.NodeID) (Configuration, error) {
if len(cfg.GUI.Password) > 0 && cfg.GUI.Password[0] != '$' {
hash, err := bcrypt.GenerateFromPassword([]byte(cfg.GUI.Password), 0)
if err != nil {
l.Warnln(err)
l.Warnln("bcrypting password:", err)
} else {
cfg.GUI.Password = string(hash)
}

View File

@ -96,7 +96,7 @@ func (v Simple) Archive(filePath string) error {
versions, err := filepath.Glob(filepath.Join(dir, file+"~*"))
if err != nil {
l.Warnln(err)
l.Warnln("globbing:", err)
return nil
}
@ -108,7 +108,7 @@ func (v Simple) Archive(filePath string) error {
}
err = os.Remove(toRemove)
if err != nil {
l.Warnln(err)
l.Warnln("removing old version:", err)
}
}
}