1
0
Fork 0
mirror of https://github.com/imjasonh/kontain.me synced 2026-07-22 07:39:59 +00:00

Report errors to clients

This commit is contained in:
Jason Hall 2020-10-25 13:00:51 -04:00
parent b64bbb6ceb
commit f8a69a8ca1
2 changed files with 11 additions and 5 deletions

View file

@ -15,7 +15,7 @@ var (
func Error(w http.ResponseWriter, err error) {
code := "INTERNAL_ERROR"
httpCode := http.StatusInternalServerError
httpCode := http.StatusNotFound
if terr, ok := err.(*transport.Error); ok {
http.Error(w, "", terr.StatusCode)
json.NewEncoder(w).Encode(terr.Errors)
@ -24,7 +24,6 @@ func Error(w http.ResponseWriter, err error) {
if err == ErrNotFound {
code = "MANIFEST_UNKNOWN"
httpCode = http.StatusNotFound
} else if err == ErrInvalid {
code = "NAME_INVALID"
httpCode = http.StatusBadRequest