add error hints

This commit is contained in:
AJ ONeal 2019-08-05 05:57:50 -06:00
parent 34ed9cc065
commit c84dc517a9
1 changed files with 12 additions and 3 deletions

View File

@ -40,15 +40,24 @@ func list(c *service.Service) ([]string, []string, []error) {
continue
}
r, err := os.Open(filepath.Join(confDir, fi.Name()))
confFile := filepath.Join(confDir, fi.Name())
r, err := os.Open(confFile)
if nil != err {
errs = append(errs, err)
errs = append(errs, &ManageError{
Name: confFile,
Hint: "Open file",
Parent: err,
})
continue
}
n, err := r.Read(b)
if nil != err {
errs = append(errs, err)
errs = append(errs, &ManageError{
Name: confFile,
Hint: "Read file",
Parent: err,
})
continue
}
b = b[:n]