change error message to make more sense
This commit is contained in:
parent
119bb79a88
commit
2a04efb10b
@ -8,6 +8,7 @@ import (
|
||||
|
||||
var (
|
||||
ErrNotExist = errors.New("resource does not exist")
|
||||
ErroNoRowsAffected = errors.New("query did not affect any rows")
|
||||
)
|
||||
|
||||
type Datastore interface {
|
||||
|
@ -10,10 +10,6 @@ import (
|
||||
"gorm.io/gorm/clause"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrorStatus = errors.New("Status is not in allowed statuses")
|
||||
)
|
||||
|
||||
type Submissions struct {
|
||||
db *gorm.DB
|
||||
}
|
||||
@ -85,7 +81,7 @@ func (env *Submissions) IfStatusThenUpdateAndGet(ctx context.Context, id int64,
|
||||
}
|
||||
|
||||
if result.RowsAffected == 0 {
|
||||
return submission, ErrorStatus
|
||||
return submission, datastore.ErroNoRowsAffected
|
||||
}
|
||||
|
||||
return submission, nil
|
||||
|
@ -3,17 +3,12 @@ package service
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"git.itzana.me/strafesnet/maps-service/pkg/api"
|
||||
"git.itzana.me/strafesnet/maps-service/pkg/datastore"
|
||||
"git.itzana.me/strafesnet/maps-service/pkg/model"
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrInvalidSourceStatus current submission status cannot change to destination status
|
||||
ErrInvalidSourceStatus = errors.New("Invalid source status")
|
||||
)
|
||||
|
||||
// POST /submissions
|
||||
func (svc *Service) CreateSubmission(ctx context.Context, request *api.SubmissionCreate) (*api.ID, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user