Skip to content

Commit c40f7ef

Browse files
author
Josh Cox
committedOct 7, 2014
Merge pull request #14 from jianfeiliao/master
Additional error handle for some special cases
2 parents 865b445 + 60b42c6 commit c40f7ef

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed
 

‎connection.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func NewConnFromConfigFile(location string) (c EurekaConnection, err error) {
4444
cfg, err := ReadConfig(location)
4545
if err != nil {
4646
log.Error("Problem reading config %s error: %s", location, err.Error())
47-
return c, nil
47+
return c, err
4848
}
4949
return NewConnFromConfig(cfg), nil
5050
}

‎net.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,13 @@ func (e *EurekaConnection) GetInstance(app, hostname string) (*Instance, error)
178178
slug := fmt.Sprintf("%s/%s/%s", EurekaURLSlugs["Apps"], app, hostname)
179179
reqURL := e.generateURL(slug)
180180
log.Debug("Getting instance with url %s", reqURL)
181-
body, _, err := getBody(reqURL, e.UseJson)
181+
body, rcode, err := getBody(reqURL, e.UseJson)
182182
if err != nil {
183183
return nil, err
184184
}
185+
if rcode != 200 {
186+
return nil, fmt.Errorf("Error getting instance, rcode = %d", rcode)
187+
}
185188
var ins *Instance
186189
if e.UseJson {
187190
var ij RegisterInstanceJson

0 commit comments

Comments
 (0)