change error message to make more sense

This commit is contained in:
Quaternions 2024-12-11 15:38:26 -08:00
parent 119bb79a88
commit 2a04efb10b
3 changed files with 2 additions and 10 deletions

View File

@ -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 {

View File

@ -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

View File

@ -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) {