github.com/tilt-dev/tilt@v0.33.15-0.20240515162809-0a22ed45d8a0/internal/build/error.go (about)

     1  package build
     2  
     3  import (
     4  	"errors"
     5  )
     6  
     7  // RunStepFailure indicates that the update failed because one of the user's
     8  // Runs failed (i.e. exited non-zero) -- as opposed to an infrastructure issue.
     9  type RunStepFailure struct {
    10  	err error
    11  }
    12  
    13  func NewRunStepFailure(err error) RunStepFailure {
    14  	return RunStepFailure{err: err}
    15  }
    16  
    17  func (e RunStepFailure) Unwrap() error {
    18  	return e.err
    19  }
    20  
    21  func (e RunStepFailure) Error() string {
    22  	if e.err != nil {
    23  		return e.err.Error()
    24  	}
    25  	return ""
    26  }
    27  
    28  func IsRunStepFailure(err error) bool {
    29  	var rsf RunStepFailure
    30  	if errors.As(err, &rsf) {
    31  		return true
    32  	}
    33  	return false
    34  }
    35  
    36  var _ error = RunStepFailure{}