Round 2
Make Errors a []Error Signed-off-by: Doug Davis <dug@us.ibm.com>
This commit is contained in:
parent
f565d6abb7
commit
00b1e8fca0
13 changed files with 98 additions and 116 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue