github.com/DaAlbrecht/cf-cli@v0.0.0-20231128151943-1fe19bb400b9/actor/actionerror/route_not_found_error.go (about)

     1  package actionerror
     2  
     3  import "fmt"
     4  
     5  // RouteNotFoundError is returned when a route cannot be found
     6  type RouteNotFoundError struct {
     7  	Host       string
     8  	DomainName string
     9  	Path       string
    10  	Port       int
    11  }
    12  
    13  func (e RouteNotFoundError) Error() string {
    14  	switch e.Port {
    15  	case 0:
    16  		return fmt.Sprintf("Route with host '%s', domain '%s', and path '%s' not found.", e.Host, e.DomainName, e.path())
    17  	default:
    18  		return fmt.Sprintf("Route with domain '%s' and port %d not found.", e.DomainName, e.Port)
    19  	}
    20  }
    21  
    22  func (e RouteNotFoundError) path() string {
    23  	if e.Path == "" {
    24  		return "/"
    25  	}
    26  	return e.Path
    27  }