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

     1  package rationalize
     2  
     3  import (
     4  	"errors"
     5  	"fmt"
     6  )
     7  
     8  // Inner is just an alias because otherwise external use of this struct would not be able to construct the error
     9  // property, and we want to keep the boilerplate minimal.
    10  type Inner error
    11  
    12  // ErrNoProject communicates that we were unable to find an activestate.yaml
    13  var ErrNoProject = errors.New("no project")
    14  
    15  // ErrNotAuthenticated communicates that the user is not logged in
    16  var ErrNotAuthenticated = errors.New("not authenticated")
    17  
    18  var ErrActionAborted = errors.New("aborted by user")
    19  
    20  var ErrHeadless = errors.New("headless")
    21  
    22  type ErrAPI struct {
    23  	Wrapped error
    24  	Code    int
    25  	Message string
    26  }
    27  
    28  func (e *ErrAPI) Error() string { return fmt.Sprintf("API code %d: %s", e.Code, e.Message) }
    29  
    30  func (e *ErrAPI) Unwrap() error { return e.Wrapped }