Remove layers of indirection between apiinstaller and resthandler

Make the RESTHandler feel more go-restful, set the stage for adding
new types of subresource collections.
This commit is contained in:
Clayton Coleman
2015-02-09 09:47:13 -05:00
parent 55e8357c0f
commit d167c11b59
10 changed files with 747 additions and 444 deletions

View File

@@ -35,7 +35,21 @@ func errToAPIStatus(err error) *api.Status {
switch t := err.(type) {
case statusError:
status := t.Status()
status.Status = api.StatusFailure
if len(status.Status) == 0 {
}
switch status.Status {
case api.StatusSuccess:
if status.Code == 0 {
status.Code = http.StatusOK
}
case "":
status.Status = api.StatusFailure
fallthrough
case api.StatusFailure:
if status.Code == 0 {
status.Code = http.StatusInternalServerError
}
}
//TODO: check for invalid responses
return &status
default: