github.com/grafana/tanka@v0.26.1-0.20240506093700-c22cfc35c21a/pkg/kubernetes/client/errors.go (about)

     1  package client
     2  
     3  import "fmt"
     4  
     5  // ErrorNotFound means that the requested object is not found on the server
     6  type ErrorNotFound struct {
     7  	errOut string
     8  }
     9  
    10  func (e ErrorNotFound) Error() string {
    11  	return e.errOut
    12  }
    13  
    14  // ErrorUnknownResource means that the requested resource type is unknown to the
    15  // server
    16  type ErrorUnknownResource struct {
    17  	errOut string
    18  }
    19  
    20  func (e ErrorUnknownResource) Error() string {
    21  	return e.errOut
    22  }
    23  
    24  // ErrorNoContext means that the context that was searched for couldn't be found
    25  type ErrorNoContext string
    26  
    27  func (e ErrorNoContext) Error() string {
    28  	return fmt.Sprintf("no context named `%s` was found. Please check your $KUBECONFIG", string(e))
    29  }
    30  
    31  // ErrorNoCluster means that the cluster that was searched for couldn't be found
    32  type ErrorNoCluster string
    33  
    34  func (e ErrorNoCluster) Error() string {
    35  	return fmt.Sprintf("no cluster that matches the apiServer `%s` was found. Please check your $KUBECONFIG", string(e))
    36  }
    37  
    38  // ErrorNothingReturned means that there was no output returned
    39  type ErrorNothingReturned struct{}
    40  
    41  func (e ErrorNothingReturned) Error() string {
    42  	return "kubectl returned no output"
    43  }