Skip to content

Commit a7d4759

Browse files
authored
Merge pull request ActiveState#3566 from ActiveState/mitchell/dx-3137
Localize an access denied error when attempting to migrate an activestate.yaml.
2 parents f4c94aa + 6fba38b commit a7d4759

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/projectfile/yamlfield.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
"regexp"
88

99
"github.com/ActiveState/cli/internal/errs"
10+
"github.com/ActiveState/cli/internal/locale"
11+
"github.com/ActiveState/cli/internal/osutils"
1012
"gopkg.in/yaml.v2"
1113
)
1214

@@ -56,6 +58,11 @@ func (y *yamlField) Save(path string) error {
5658
}
5759

5860
if err := os.WriteFile(path, out, 0664); err != nil {
61+
if osutils.IsAccessDeniedError(err) {
62+
return locale.WrapInputError(err, "err_migrate_projectfile_access_denied",
63+
"Your project file at '{{.V0}}' is out of date, but State Tool does not have permission to update it. Please make it writeable or re-checkout the project to a writeable location.",
64+
path)
65+
}
5966
return errs.Wrap(err, "ioutil.WriteFile %s failed", path)
6067
}
6168

0 commit comments

Comments
 (0)