Files
evening_detective_server/internal/app/gameplay_errors.go
T
2026-10-03 01:28:09 +07:00

21 lines
565 B
Go

package app
import (
"errors"
"evening_detective_server/internal/services/gameplay_service"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func gameplayErrorStatus(err error, internalMessage string) error {
if errors.Is(err, gameplay_service.ErrTeamNotFound) {
return status.Error(codes.NotFound, gameplay_service.ErrTeamNotFound.Error())
}
if errors.Is(err, gameplay_service.ErrGameNotFound) {
return status.Error(codes.NotFound, gameplay_service.ErrGameNotFound.Error())
}
return status.Error(codes.Internal, internalMessage)
}