Skip to content

Commit

Permalink
Merge branch version/0-42-0-RC1 to adopt changes from PR #2876
Browse files Browse the repository at this point in the history
  • Loading branch information
as-builds committed Nov 10, 2023
2 parents ad0ad49 + f8d87dc commit 24ecbdc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/runbits/rationalize/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ var ErrNotAuthenticated = errors.New("not authenticated")

var ErrActionAborted = errors.New("aborted by user")

var ErrHeadless = errors.New("headless")

type ErrAPI struct {
Wrapped error
Code int
Expand Down
11 changes: 11 additions & 0 deletions internal/runbits/requirements/rationalize.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,20 @@ func (r *RequirementOperation) rationalizeError(err *error) {
buildPlannerErr.LocalizedError(),
errs.SetIf(buildPlannerErr.InputError(), errs.SetInput()))

// Project not found
case errors.Is(*err, rationalize.ErrNoProject):
*err = errs.WrapUserFacing(*err,
locale.Tr("err_no_project"),
errs.SetInput())

// Headless
case errors.Is(*err, rationalize.ErrHeadless):
*err = errs.WrapUserFacing(*err,
locale.Tl(
"err_requirement_headless",
"Cannot update requirements for a headless project. Please visit {{.V0}} to convert your project and try again.",
r.Project.URL(),
),
errs.SetInput())
}
}
3 changes: 3 additions & 0 deletions internal/runbits/requirements/requirements.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ func (r *RequirementOperation) ExecuteRequirementOperation(requirementName, requ
if r.Project == nil {
return rationalize.ErrNoProject
}
if r.Project.IsHeadless() {
return rationalize.ErrHeadless
}
out.Notice(locale.Tl("operating_message", "", r.Project.NamespaceString(), r.Project.Dir()))

switch nsType {
Expand Down

0 comments on commit 24ecbdc

Please sign in to comment.