github.com/lukasheimann/cloudfoundrycli@v7.1.0+incompatible/command/translatableerror/upload_failed_error.go (about)

     1  package translatableerror
     2  
     3  type UploadFailedError struct {
     4  	Err error
     5  }
     6  
     7  func (UploadFailedError) Error() string {
     8  	return "Uploading files have failed after a number of retries due to: {{.Error}}"
     9  }
    10  
    11  func (e UploadFailedError) Translate(translate func(string, ...interface{}) string) string {
    12  	message := translate("UNKNOWN REASON")
    13  	if err, ok := e.Err.(TranslatableError); ok {
    14  		message = err.Translate(translate)
    15  	} else if e.Err != nil {
    16  		message = e.Err.Error()
    17  	}
    18  
    19  	return translate(e.Error(), map[string]interface{}{
    20  		"Error": message,
    21  	})
    22  }