github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/atc/exec/artifact/error.go (about)

     1  package artifact
     2  
     3  import (
     4  	"fmt"
     5  )
     6  
     7  // UnspecifiedArtifactSourceError is returned when the specified path is of a
     8  // file in the toplevel directory, and so it does not indicate a SourceName.
     9  type UnspecifiedArtifactSourceError struct {
    10  	Path string
    11  }
    12  
    13  // Error returns a human-friendly error message.
    14  func (err UnspecifiedArtifactSourceError) Error() string {
    15  	return fmt.Sprintf("path '%s' does not specify where the file lives", err.Path)
    16  }
    17  
    18  // UnknownArtifactSourceError is returned when the artifact.Name specified by the
    19  // path does not exist in the artifact.Repository.
    20  type UnknownArtifactSourceError struct {
    21  	Name string
    22  	Path string
    23  }
    24  
    25  // Error returns a human-friendly error message.
    26  func (err UnknownArtifactSourceError) Error() string {
    27  	return fmt.Sprintf("unknown artifact source: '%s' in file path '%s'", err.Name, err.Path)
    28  }
    29  
    30  // FileNotFoundError is returned when the specified file path does not
    31  // exist within its artifact source.
    32  type FileNotFoundError struct {
    33  	Name     string
    34  	FilePath string
    35  }
    36  
    37  // Error returns a human-friendly error message.
    38  func (err FileNotFoundError) Error() string {
    39  	return fmt.Sprintf("file '%s' not found within artifact '%s'", err.FilePath, err.Name)
    40  }