github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/internal/runners/manifest/rationalize.go (about)

     1  package manifest
     2  
     3  import (
     4  	"errors"
     5  
     6  	"github.com/ActiveState/cli/internal/errs"
     7  	"github.com/ActiveState/cli/internal/locale"
     8  	"github.com/ActiveState/cli/internal/runbits/rationalize"
     9  	"github.com/ActiveState/cli/pkg/platform/runtime/store"
    10  )
    11  
    12  func rationalizeError(rerr *error) {
    13  	switch {
    14  	case rerr == nil:
    15  		return
    16  
    17  	// No activestate.yaml.
    18  	case errors.Is(*rerr, rationalize.ErrNoProject):
    19  		*rerr = errs.WrapUserFacing(*rerr,
    20  			locale.T("err_no_project"),
    21  			errs.SetInput(),
    22  		)
    23  	case errors.Is(*rerr, store.ErrNoBuildPlanFile):
    24  		*rerr = errs.WrapUserFacing(*rerr,
    25  			locale.Tl(
    26  				"err_manifest_no_build_plan_file",
    27  				"Could not source runtime. Please ensure your runtime is up to date by running '[ACTIONABLE]state refresh[/RESET]'.",
    28  			),
    29  			errs.SetInput(),
    30  		)
    31  	}
    32  }