Pass through known errors

Signed-off-by: Troels Thomsen <troels@thomsen.io>
This commit is contained in:
Troels Thomsen 2016-04-29 23:34:24 +02:00
parent c0dcad3a48
commit 28be207bc0
4 changed files with 8 additions and 0 deletions

View file

@ -634,6 +634,8 @@ func (app *App) dispatcher(dispatch dispatchFunc) http.Handler {
context.Errors = append(context.Errors, v2.ErrorCodeNameUnknown.WithDetail(err))
case distribution.ErrRepositoryNameInvalid:
context.Errors = append(context.Errors, v2.ErrorCodeNameInvalid.WithDetail(err))
case errcode.Error:
context.Errors = append(context.Errors, err)
}
if err := errcode.ServeJSON(w, context.Errors); err != nil {