Mercurial > gemma
changeset 2954:972400e56e4a
Do not report client errors as server error
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 05 Apr 2019 18:44:49 +0200 |
parents | 3c1b9a6ee04e |
children | e9ff3e8d3c46 7a51fdfead2d |
files | pkg/controllers/importqueue.go |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/controllers/importqueue.go Fri Apr 05 16:16:49 2019 +0200 +++ b/pkg/controllers/importqueue.go Fri Apr 05 18:44:49 2019 +0200 @@ -579,12 +579,18 @@ err = tx.QueryRowContext(ctx, isPendingSQL, id).Scan(&pending, &kind) switch { case err == sql.ErrNoRows: - err = fmt.Errorf("cannot find import #%d", id) + err = JSONError{ + Code: http.StatusNotFound, + Message: fmt.Sprintf("cannot find import #%d", id), + } return case err != nil: return case !pending: - err = fmt.Errorf("import %d is not pending", id) + err = JSONError{ + Code: http.StatusConflict, + Message: fmt.Sprintf("import #%d is not pending", id), + } return }