Skip to content

Commit ec7b88b

Browse files
arschlesAaron Schlesinger
authored andcommitted
fix(controller.go,get_app_config.go,publish_release.go): return controller URL that errored
1 parent cd25df8 commit ec7b88b

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

pkg/gitreceive/controller.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@ var (
1212
)
1313

1414
type unexpectedControllerStatusCode struct {
15+
endpoint string
1516
expected int
1617
actual int
1718
}
1819

20+
func newUnexpectedControllerStatusCode(endpoint string, expectedCode, actualCode int) unexpectedControllerStatusCode {
21+
return unexpectedControllerStatusCode{endpoint: endpoint, expected: expectedCode, actual: actualCode}
22+
}
23+
1924
func (u unexpectedControllerStatusCode) Error() string {
20-
return fmt.Sprintf("Expected status code %d from Deis controller, got %d", u.expected, u.actual)
25+
return fmt.Sprintf("Deis controller endpoint %s: expected status code %d, got %d", u.endpoint, u.expected, u.actual)
2126
}
2227

2328
func controllerURLStr(conf *Config, additionalPath ...string) string {

pkg/gitreceive/get_app_config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func getAppConfig(conf *Config, builderKey, userName, appName string) (*pkg.Conf
4040
if res.StatusCode == 404 {
4141
return nil, errControllerNotFound
4242
} else if res.StatusCode != 200 {
43-
return nil, unexpectedControllerStatusCode{expected: 200, actual: res.StatusCode}
43+
return nil, newUnexpectedControllerStatusCode(url, 200, res.StatusCode)
4444
}
4545

4646
ret := &pkg.Config{}

pkg/gitreceive/publish_release.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func publishRelease(conf *Config, builderKey string, buildHook *pkg.BuildHook) (
3636
} else if res.StatusCode == http.StatusServiceUnavailable {
3737
return nil, errControllerServiceUnavailable
3838
} else if res.StatusCode != 200 {
39-
return nil, unexpectedControllerStatusCode{expected: 200, actual: res.StatusCode}
39+
return nil, newUnexpectedControllerStatusCode(url, 200, res.StatusCode)
4040
}
4141

4242
ret := new(pkg.BuildHookResponse)

0 commit comments

Comments
 (0)