github.com/helmwave/helmwave@v0.36.4-0.20240509190856-b35563eba4c6/pkg/hooks/errors.go (about)

     1  package hooks
     2  
     3  import (
     4  	"errors"
     5  	"fmt"
     6  )
     7  
     8  var ErrUnknownFormat = errors.New("unknown format")
     9  
    10  type CreatePipeError struct {
    11  	Err error
    12  }
    13  
    14  func NewCreatePipeError(err error) error {
    15  	return &CreatePipeError{Err: err}
    16  }
    17  
    18  func (err CreatePipeError) Error() string {
    19  	return fmt.Sprintf("failed to create command pipe: %s", err.Err)
    20  }
    21  
    22  func (err CreatePipeError) Unwrap() error {
    23  	return err.Err
    24  }
    25  
    26  type CommandRunError struct {
    27  	Err error
    28  }
    29  
    30  func NewCommandRunError(err error) error {
    31  	return &CommandRunError{Err: err}
    32  }
    33  
    34  func (err CommandRunError) Error() string {
    35  	return fmt.Sprintf("failed to run command: %s", err.Err)
    36  }
    37  
    38  func (err CommandRunError) Unwrap() error {
    39  	return err.Err
    40  }
    41  
    42  type CommandReadOutputError struct {
    43  	Err error
    44  }
    45  
    46  func NewCommandReadOutputError(err error) error {
    47  	return &CommandReadOutputError{Err: err}
    48  }
    49  
    50  func (err CommandReadOutputError) Error() string {
    51  	return fmt.Sprintf("failed to read command stdout: %s", err.Err)
    52  }
    53  
    54  func (err CommandReadOutputError) Unwrap() error {
    55  	return err.Err
    56  }
    57  
    58  type YAMLDecodeError struct {
    59  	Err error
    60  }
    61  
    62  func NewYAMLDecodeError(err error) error {
    63  	return &YAMLDecodeError{Err: err}
    64  }
    65  
    66  func (err YAMLDecodeError) Error() string {
    67  	return fmt.Sprintf("failed to decode lifecycle config from YAML: %s", err.Err)
    68  }
    69  
    70  func (err YAMLDecodeError) Unwrap() error {
    71  	return err.Err
    72  }