This commit is contained in:
Vyacheslav1557 2024-10-05 20:19:02 +05:00
parent 466a81903a
commit b2d7f4e1c5
3 changed files with 6 additions and 9 deletions

View file

@ -2,7 +2,6 @@ package models
import ( import (
"errors" "errors"
"git.sch9.ru/new_gate/ms-tester/internal/lib"
) )
type Result int32 type Result int32
@ -27,5 +26,5 @@ func (result Result) Valid() error {
case NotTested, Accepted, TimeLimitExceeded, MemoryLimitExceeded, CompilationError, SystemFailDuringTesting: case NotTested, Accepted, TimeLimitExceeded, MemoryLimitExceeded, CompilationError, SystemFailDuringTesting:
return nil return nil
} }
return lib.ServiceError(ErrBadResult, lib.ErrValidationFailed, "bad result") return ErrBadResult
} }

View file

@ -2,7 +2,6 @@ package models
import ( import (
"errors" "errors"
"git.sch9.ru/new_gate/ms-tester/internal/lib"
) )
type Role int32 type Role int32
@ -45,7 +44,7 @@ func (role Role) Valid() error {
case RoleSpectator, RoleParticipant, RoleModerator, RoleAdmin: case RoleSpectator, RoleParticipant, RoleModerator, RoleAdmin:
return nil return nil
} }
return lib.ServiceError(ErrBadRole, lib.ErrValidationFailed, "bad role") return ErrBadRole
} }
func (role Role) AsPointer() *Role { func (role Role) AsPointer() *Role {

View file

@ -2,7 +2,6 @@ package models
import ( import (
"errors" "errors"
"git.sch9.ru/new_gate/ms-tester/internal/lib"
) )
type TestingStrategy int32 type TestingStrategy int32
@ -30,5 +29,5 @@ func (ts TestingStrategy) Valid() error {
case EachTestTS, CompleteGroupTS: case EachTestTS, CompleteGroupTS:
return nil return nil
} }
return lib.ServiceError(ErrBadTestingStrategy, lib.ErrValidationFailed, "bad testing strategy") return ErrBadTestingStrategy
} }