github.com/chenbh/concourse/v6@v6.4.2/atc/runtime/errors.go (about)

     1  package runtime
     2  
     3  import "fmt"
     4  
     5  // FileNotFoundError is the error to return from StreamFile when the given path
     6  // does not exist.
     7  type FileNotFoundError struct {
     8  	Path string
     9  }
    10  
    11  // Error prints a helpful message including the file path. The user will see
    12  // this message if e.g. their task config path does not exist.
    13  func (err FileNotFoundError) Error() string {
    14  	return fmt.Sprintf("file not found: %s", err.Path)
    15  }
    16  
    17  type ErrResourceScriptFailed struct {
    18  	Path       string
    19  	Args       []string
    20  	ExitStatus int
    21  
    22  	Stderr string
    23  }
    24  
    25  func (err ErrResourceScriptFailed) Error() string {
    26  	msg := fmt.Sprintf(
    27  		"resource script '%s %v' failed: exit status %d",
    28  		err.Path,
    29  		err.Args,
    30  		err.ExitStatus,
    31  	)
    32  
    33  	if len(err.Stderr) > 0 {
    34  		msg += "\n\nstderr:\n" + err.Stderr
    35  	}
    36  
    37  	return msg
    38  }