Skip to content

Commit

Permalink
made port and host errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonrichardsmith committed May 21, 2016
1 parent 3f27153 commit 6676280
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions service.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,16 @@ import (
yaml "gopkg.in/yaml.v2"
)

var serviceFile string
var servicePort string
var serviceHost string
var (
serviceFile string
servicePort string
serviceHost string
)

var (
ErrNoPort = errors.New("No port set")
ErrNoHost = errors.New("No host set")
)

func init() {
flag.StringVar(&serviceFile, "service-file", "Service.yaml", "Full path to service file.")
Expand Down Expand Up @@ -91,11 +98,11 @@ func This() (*Service, error) {
}
s.Port = servicePort
if s.Port == "" {
return s, errors.New("No port set")
return s, ErrNoPort
}
s.Host = serviceHost
if s.Host == "" {
return s, errors.New("No host set")
return s, ErrNoHost
}
return s, err
}
Expand Down

0 comments on commit 6676280

Please sign in to comment.