Skip to content

Commit 0a2cc64

Browse files
authored
Update CLI file access error messages (#897)
1 parent 3ebd928 commit 0a2cc64

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cli/cmd/root.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"path/filepath"
2323
"strings"
2424

25+
"github.com/cortexlabs/cortex/pkg/lib/errors"
2526
"github.com/cortexlabs/cortex/pkg/lib/exit"
2627
s "github.com/cortexlabs/cortex/pkg/lib/strings"
2728
"github.com/cortexlabs/cortex/pkg/lib/telemetry"
@@ -45,18 +46,21 @@ var _flagEnv string
4546
func init() {
4647
cwd, err := os.Getwd()
4748
if err != nil {
49+
err := errors.Wrap(err, "unable to determine current working directory")
4850
exit.Error(err)
4951
}
5052
_cwd = s.EnsureSuffix(cwd, "/")
5153

5254
homeDir, err := homedir.Dir()
5355
if err != nil {
56+
err := errors.Wrap(err, "unable to determine home directory")
5457
exit.Error(err)
5558
}
5659

5760
_localDir = filepath.Join(homeDir, ".cortex")
5861
err = os.MkdirAll(_localDir, os.ModePerm)
5962
if err != nil {
63+
err := errors.Wrap(err, "unable to write to home directory", _localDir)
6064
exit.Error(err)
6165
}
6266

0 commit comments

Comments
 (0)