Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

Commit

Permalink
Merge pull request #39 from tavisto/error_message_imporovements
Browse files Browse the repository at this point in the history
Added response body output whenever marathon throws back an error.
  • Loading branch information
shoenig committed Jul 22, 2017
2 parents ed575eb + b07c5e9 commit ebb6c40
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app.go
Expand Up @@ -237,7 +237,7 @@ func (a AppUpdate) update(id string, body io.ReadCloser) {
Check(e == nil, "failed to get response", e)
defer response.Body.Close()
sc := response.StatusCode
Check(sc == 200, "bad status code", sc)
Check(sc == 200, "bad status code", sc, a.format.Format(response.Body, a.Humanize))
fmt.Println(a.format.Format(response.Body, a.Humanize))
}

Expand Down Expand Up @@ -289,7 +289,7 @@ func (a AppDestroy) Apply(args []string) {
Check(e == nil, "destroy app failed", e)
c := response.StatusCode
// documentation says this is 204, wtf
Check(c == 200, "destroy app bad status", c)
Check(c == 200, "destroy app bad status", c, a.format.Format(response.Body, a.Humanize))
defer response.Body.Close()
fmt.Println(a.format.Format(response.Body, a.Humanize))
}
Expand Down
2 changes: 1 addition & 1 deletion client.go
Expand Up @@ -77,7 +77,7 @@ func getTransportConfig(insecure bool) *http.Transport {
cfg := &tls.Config{}
cfg.InsecureSkipVerify = insecure
return &http.Transport{
Proxy: http.ProxyFromEnvironment,
Proxy: http.ProxyFromEnvironment,
TLSClientConfig: cfg,
DisableCompression: true,
}
Expand Down
4 changes: 2 additions & 2 deletions group.go
Expand Up @@ -113,7 +113,7 @@ func (g GroupDestroy) Apply(args []string) {
defer response.Body.Close()
c := response.StatusCode
Check(c != 404, "unknown group")
Check(c == 200, "destroy group bad status", c)
Check(c == 200, "destroy group bad status", c, g.format.Format(response.Body, g.Humanize))

fmt.Println(g.format.Format(response.Body, g.Humanize))
}
Expand Down Expand Up @@ -145,7 +145,7 @@ func (g GroupUpdate) Apply(args []string) {
defer response.Body.Close()

sc := response.StatusCode
Check(sc == 200, "bad status code", sc)
Check(sc == 200, "bad status code", sc, g.format.Format(response.Body, g.Humanize))

fmt.Println(g.format.Format(response.Body, g.Humanize))
}
Expand Down
4 changes: 2 additions & 2 deletions marathon.go
Expand Up @@ -81,7 +81,7 @@ func (l MarathonLeader) Apply(args []string) {
response, e := l.client.Do(request)
Check(e == nil, "get leader failed", e)
c := response.StatusCode
Check(c == 200, "get leader bad status", c)
Check(c == 200, "get leader bad status", c, l.format.Format(response.Body, l.Humanize))
defer response.Body.Close()
fmt.Println(l.format.Format(response.Body, l.Humanize))
}
Expand All @@ -106,7 +106,7 @@ func (a MarathonAbdicate) Apply(args []string) {
response, e := a.client.Do(request)
Check(e == nil, "abdicate request failed", e)
c := response.StatusCode
Check(c == 200, "abdicate bad status", c)
Check(c == 200, "abdicate bad status", c, a.format.Format(response.Body, a.Humanize))
defer response.Body.Close()
fmt.Println(a.format.Format(response.Body, a.Humanize))
}
Expand Down
4 changes: 2 additions & 2 deletions task.go
Expand Up @@ -114,7 +114,7 @@ func (t TaskKill) killAll(id string) {

sc := response.StatusCode
Check(sc != 404, "unknown id")
Check(sc == 200, "failed with status code", sc)
Check(sc == 200, "failed with status code", sc, t.format.Format(response.Body, t.Humanize))
t.format.Format(response.Body, t.Humanize)
}

Expand All @@ -128,7 +128,7 @@ func (t TaskKill) killOnly(id, taskid string) {
defer response.Body.Close()
sc := response.StatusCode
Check(sc != 404, "unknown appid or taskid")
Check(sc == 200, "failed with status code", sc)
Check(sc == 200, "failed with status code", sc, t.format.Format(response.Body, t.Humanize))
t.format.Format(response.Body, t.Humanize)
}

Expand Down

0 comments on commit ebb6c40

Please sign in to comment.