changeset 1471:9a0231e6749d bulkreview

Import bulk review: Removed JSONErrors from decideImport. TODO: Move this to models.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 30 Nov 2018 09:32:01 +0100
parents c89a18f8027d
children 702671b76eae
files pkg/controllers/importqueue.go
diffstat 1 files changed, 2 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/controllers/importqueue.go	Fri Nov 30 09:17:03 2018 +0100
+++ b/pkg/controllers/importqueue.go	Fri Nov 30 09:32:01 2018 +0100
@@ -410,18 +410,12 @@
 	err = tx.QueryRowContext(ctx, isPendingSQL, id).Scan(&pending, &kind)
 	switch {
 	case err == sql.ErrNoRows:
-		err = JSONError{
-			Code:    http.StatusNotFound,
-			Message: fmt.Sprintf("Cannot find import #%d.", id),
-		}
+		err = fmt.Errorf("Cannot find import #%d.", id)
 		return
 	case err != nil:
 		return
 	case !pending:
-		err = JSONError{
-			Code:    http.StatusBadRequest,
-			Message: fmt.Sprintf("Import %d is not pending.", id),
-		}
+		err = fmt.Errorf("Import %d is not pending.", id)
 		return
 	}