github.com/liamawhite/cli-with-i18n@v6.32.1-0.20171122084555-dede0a5c3448+incompatible/command/translatableerror/service_instance_not_found_error.go (about)

     1  package translatableerror
     2  
     3  type ServiceInstanceNotFoundError struct {
     4  	GUID string
     5  	Name string
     6  }
     7  
     8  func (e ServiceInstanceNotFoundError) Error() string {
     9  	if e.Name == "" {
    10  		return "Service instance (GUID: {{.GUID}}) not found"
    11  	}
    12  	return "Service instance {{.ServiceInstance}} not found"
    13  }
    14  
    15  func (e ServiceInstanceNotFoundError) Translate(translate func(string, ...interface{}) string) string {
    16  	return translate(e.Error(), map[string]interface{}{
    17  		"GUID":            e.GUID,
    18  		"ServiceInstance": e.Name,
    19  	})
    20  }