Merge pull request #651 from mrunalp/quota_validation

Add more information in the error messages when writing to a file
This commit is contained in:
Michael Crosby 2016-03-21 17:53:49 -07:00
commit e80b6b67e6
1 changed files with 4 additions and 1 deletions

View File

@ -351,7 +351,10 @@ func writeFile(dir, file, data string) error {
if dir == "" {
return fmt.Errorf("no such directory for %s.", file)
}
return ioutil.WriteFile(filepath.Join(dir, file), []byte(data), 0700)
if err := ioutil.WriteFile(filepath.Join(dir, file), []byte(data), 0700); err != nil {
return fmt.Errorf("failed to write %v to %v: %v", data, file, err)
}
return nil
}
func readFile(dir, file string) (string, error) {