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()) } if errors.Is(err, gameplay_service.ErrMovesNotAllowed) { return status.Error(codes.FailedPrecondition, gameplay_service.ErrMovesNotAllowed.Error()) } return status.Error(codes.Internal, internalMessage) }