comparison pkg/controllers/importqueue.go @ 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 286a3306f6bf
children 702671b76eae
comparison
equal deleted inserted replaced
1470:c89a18f8027d 1471:9a0231e6749d
408 var kind string 408 var kind string
409 409
410 err = tx.QueryRowContext(ctx, isPendingSQL, id).Scan(&pending, &kind) 410 err = tx.QueryRowContext(ctx, isPendingSQL, id).Scan(&pending, &kind)
411 switch { 411 switch {
412 case err == sql.ErrNoRows: 412 case err == sql.ErrNoRows:
413 err = JSONError{ 413 err = fmt.Errorf("Cannot find import #%d.", id)
414 Code: http.StatusNotFound,
415 Message: fmt.Sprintf("Cannot find import #%d.", id),
416 }
417 return 414 return
418 case err != nil: 415 case err != nil:
419 return 416 return
420 case !pending: 417 case !pending:
421 err = JSONError{ 418 err = fmt.Errorf("Import %d is not pending.", id)
422 Code: http.StatusBadRequest,
423 Message: fmt.Sprintf("Import %d is not pending.", id),
424 }
425 return 419 return
426 } 420 }
427 421
428 if state == "accepted" { 422 if state == "accepted" {
429 if jc := imports.FindJobCreator(imports.JobKind(kind)); jc != nil { 423 if jc := imports.FindJobCreator(imports.JobKind(kind)); jc != nil {