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:
parent
b64bbb6ceb
commit
f8a69a8ca1
2 changed files with 11 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue