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 (
"errors"
"git.sch9.ru/new_gate/ms-tester/internal/lib"
)
type Result int32
@ -10,12 +9,12 @@ type Result int32
const (
NotTested Result = 1 // change only with schema change
Accepted Result = 2
WrongAnswer Result = 3
PresentationError Result = 4
WrongAnswer Result = 3
PresentationError Result = 4
CompilationError Result = 5
MemoryLimitExceeded Result = 6
TimeLimitExceeded Result = 7
RuntimeError Result = 8
RuntimeError Result = 8
SystemFailDuringTesting Result = 9
Testing Result = 10
)
@ -27,5 +26,5 @@ func (result Result) Valid() error {
case NotTested, Accepted, TimeLimitExceeded, MemoryLimitExceeded, CompilationError, SystemFailDuringTesting:
return nil
}
return lib.ServiceError(ErrBadResult, lib.ErrValidationFailed, "bad result")
return ErrBadResult
}

View file

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

View file

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