Return remote API errors as JSON
Signed-off-by: Ben Firshman <ben@firshman.co.uk> Upstream-commit: 322e2a7d059a81617b593cf6ece2cfd9f6d4ea03 Component: engine
This commit is contained in:
@ -1507,3 +1507,10 @@ func waitForGoroutines(expected int) error {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// getErrorMessage returns the error message from an error API response
|
||||
func getErrorMessage(c *check.C, body []byte) string {
|
||||
var resp types.ErrorResponse
|
||||
c.Assert(json.Unmarshal(body, &resp), check.IsNil)
|
||||
return strings.TrimSpace(resp.Message)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user