Skip to content

Commit

Permalink
more clearly error info
Browse files Browse the repository at this point in the history
  • Loading branch information
QLeelulu committed Sep 26, 2018
1 parent 5279e15 commit b2585af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package conf

import (
"errors"
"fmt"
"io/ioutil"
"os"
"path"
Expand Down Expand Up @@ -178,12 +179,12 @@ func (c *Conf) genUUID() (string, error) {

uuidDir := path.Dir(c.UUIDFile)
if err := os.MkdirAll(uuidDir, 0755); err != nil {
return "", err
return "", fmt.Errorf("failed to write UUID to file: %s. you can change UUIDFile config in base.json", err)
}

err = ioutil.WriteFile(c.UUIDFile, []byte(u.String()), 0600)
if err != nil {
return "", err
return "", fmt.Errorf("failed to write UUID to file: %s. you can change UUIDFile config in base.json", err)
}

return u.String(), nil
Expand Down
4 changes: 2 additions & 2 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@ func (n *Node) writePIDFile() {
dir := path.Dir(n.PIDFile)
err := os.MkdirAll(dir, 0755)
if err != nil {
log.Errorf("Failed to write pid file: %s", err)
log.Errorf("Failed to write pid file: %s. you can change PIDFile config in base.json", err)
return
}

n.PIDFile = path.Join(dir, filename)
err = ioutil.WriteFile(n.PIDFile, []byte(n.PID), 0644)
if err != nil {
log.Errorf("Failed to write pid file: %s", err)
log.Errorf("Failed to write pid file: %s. you can change PIDFile config in base.json", err)
return
}
}
Expand Down

0 comments on commit b2585af

Please sign in to comment.