This commit is contained in:
2026-10-03 01:16:40 +07:00
parent 3f7731411b
commit c69dfb8503
10 changed files with 234 additions and 59 deletions
+23
View File
@@ -0,0 +1,23 @@
package app
import (
"errors"
"evening_detective_server/internal/services/game_review_service"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func reviewErrorStatus(err error, internalMessage string) error {
switch {
case errors.Is(err, game_review_service.ErrTeamNotFound), errors.Is(err, game_review_service.ErrGameNotFound), errors.Is(err, game_review_service.ErrReviewNotFound):
return status.Error(codes.NotFound, err.Error())
case errors.Is(err, game_review_service.ErrInvalidReview), errors.Is(err, game_review_service.ErrInvalidStatus):
return status.Error(codes.InvalidArgument, err.Error())
case errors.Is(err, game_review_service.ErrGameNotFinished), errors.Is(err, game_review_service.ErrReviewExists):
return status.Error(codes.FailedPrecondition, err.Error())
default:
return status.Error(codes.Internal, internalMessage)
}
}