Make Errors a []Error

Signed-off-by: Doug Davis <dug@us.ibm.com>
This commit is contained in:
Doug Davis 2015-05-26 17:18:32 -07:00
parent f565d6abb7
commit 00b1e8fca0
13 changed files with 98 additions and 116 deletions

View file

@ -14,8 +14,8 @@ func serveJSON(w http.ResponseWriter, v interface{}) error {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
sc := http.StatusInternalServerError
if errs, ok := v.(errcode.Errors); ok && errs.Len() > 0 {
sc = errs.Errors[0].Code.Descriptor().HTTPStatusCode
if errs, ok := v.(errcode.Errors); ok && len(errs) > 0 {
sc = errs[0].Code.Descriptor().HTTPStatusCode
if sc == 0 {
sc = http.StatusInternalServerError
}