Skip to content

Commit 78a2f9b

Browse files
committed
Merge branch version/0-42-0-RC1 to adopt changes from PR #2872
2 parents b783202 + 447ca43 commit 78a2f9b

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

internal/runbits/requirements/rationalize.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55

66
"github.com/ActiveState/cli/internal/errs"
77
"github.com/ActiveState/cli/internal/locale"
8+
"github.com/ActiveState/cli/internal/runbits/rationalize"
89
"github.com/ActiveState/cli/pkg/localcommit"
910
bpModel "github.com/ActiveState/cli/pkg/platform/api/buildplanner/model"
1011
"github.com/ActiveState/cli/pkg/platform/model"
@@ -50,5 +51,9 @@ func (r *RequirementOperation) rationalizeError(err *error) {
5051
buildPlannerErr.LocalizedError(),
5152
errs.SetIf(buildPlannerErr.InputError(), errs.SetInput()))
5253

54+
case errors.Is(*err, rationalize.ErrNoProject):
55+
*err = errs.WrapUserFacing(*err,
56+
locale.Tr("err_no_project"),
57+
errs.SetInput())
5358
}
5459
}

internal/runbits/runtime/rationalize.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ func rationalizeError(auth *authentication.Auth, proj *project.Project, rerr *er
2424
multilog.Error("runtime:rationalizeError called with nil project, error: %s", errs.JoinMessage(*rerr))
2525
*rerr = errs.Pack(*rerr, errs.New("project is nil"))
2626

27+
case proj.IsHeadless():
28+
*rerr = errs.NewUserFacing(
29+
locale.Tl(
30+
"err_runtime_headless",
31+
"Cannot initialize runtime for a headless project. Please visit {{.V0}} to convert your project and try again.",
32+
proj.URL(),
33+
),
34+
errs.SetInput(),
35+
)
36+
2737
// Could not find a platform that matches on the given branch, so suggest alternate branches if ones exist
2838
case isUpdateErr && errors.As(*rerr, &errNoMatchingPlatform):
2939
branches, err := model.BranchNamesForProjectFiltered(proj.Owner(), proj.Name(), proj.BranchName())

internal/runners/activate/activate.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,6 @@ func (r *Activate) Run(params *ActivateParams) (rerr error) {
138138
}
139139
}
140140

141-
if proj != nil && proj.IsHeadless() {
142-
return locale.NewInputError("err_activate_headless", "Cannot activate a headless project. Please visit {{.V0}} to create your project.", proj.URL())
143-
}
144-
145141
if proj != nil && params.Branch != "" && params.Branch != proj.BranchName() {
146142
return locale.NewInputError("err_conflicting_branch_while_checkedout", "", params.Branch, proj.BranchName())
147143
}

0 commit comments

Comments
 (0)