Latent function with two outcomes

Hello there!

So I have a problem with doing my latent function. What i have now is function(presented below) that wait’s for bool to become true. That’s good but not enough. As you can see below i have two possible outcomes from callback, “Success” and “Failure”. Is there any good way to detect which one actually happend? My main function that is creating latent action always returns true becouse as far as I’ve seen in debugger it fires first, before even latent start. Would gladly get some information about possible solution.

My code:
My latent class


//Download scores latent class
    class VpComponentLatent :public FPendingLatentAction
    {
    public:
        FName ExecutionFunction;
        int32 OutputLink;
        FWeakObjectPtr CallbackTarget;
        ViveportComponentLatent(const FLatentActionInfo& LatentInfo);

        virtual void UpdateOperation(FLatentResponse& Response) override;
#if WITH_EDITOR
#endif
    };

My latent function:


void UVpComponent::VpComponentLatent::UpdateOperation(FLatentResponse& Response)
{
    if (ScoresRead == true)
    {

        bool finished = true;
        Response.FinishAndTriggerIf(finished, ExecutionFunction, OutputLink, CallbackTarget);
        ScoresRead = false;
    }
}

Then i have my function calling latent action:
(always returns true)


bool UVPComponent::DownloadScoresGlobal(UObject* WorldContextObject, const FString LeaderboardName, int FirstIndex, int LastIndex, struct FLatentActionInfo LatentInfo)
{
    if (UViveportApi::Init(&myInitCallback, APP_ID))
    {
        if (UViveportUserStats::IsReady(&myIsReadyStatus))
        {
            if (UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject))
            {
                FLatentActionManager& LatentActionManager = World->GetLatentActionManager();
                if (LatentActionManager.FindExistingAction<VpComponentLatent>(LatentInfo.CallbackTarget, LatentInfo.UUID) == NULL)
                {
                    UViveportUserStats::DownloadLeaderboardScores(&myDownloadLeaderboardScoreStatus, LeaderboardName, UELeaderboardDataDownload::u_ELeaderboardDataDownloadGlobal, UELeaderboardDataTimeRange::u_ELeaderboardDataScropeAllTime, FirstIndex, LastIndex);
                    LatentActionManager.AddNewAction(LatentInfo.CallbackTarget, LatentInfo.UUID, new VpComponentLatent(LatentInfo));
                    return true;
                }
            }
        }
        return false;
    }
    return false;
}

And then i have my two callbacks:



void UViveportComponent::MyDownloadLeaderboardScoreStatus::OnSuccess()
{
    FString fstring("DownloadLeaderboardScore success.");
    GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::White, fstring);
    LeaderboardEntriesArray.Empty();
    int size = UViveportUserStats::GetLeaderboardScoreCount();
    for (int i = 0; i < size; i++)
    {
        ULeaderboardScore leaderboardScore = UViveportUserStats::GetLeaderboardScore(i);
        FScorePackage ArrayEntry;
        ArrayEntry.PlayerName = leaderboardScore.UserName;
        ArrayEntry.Rank = (int32)leaderboardScore.Rank;
        ArrayEntry.Score = (int32)leaderboardScore.Score;
        LeaderboardEntriesArray.Add(ArrayEntry);
        fstring = FString::Printf(TEXT("rank=%d, name=%s, score=%d"),leaderboardScore.Rank,*leaderboardScore.UserName,leaderboardScore.Score);
        GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::White, fstring);
        ScoresRead = true;
    }

}


void UViveportComponent::MyDownloadLeaderboardScoreStatus::OnFailure(int error)
{
    const FString fstring = FString::Printf(TEXT("DownloadLeaderboardScore failure. error=%d"), error);
    GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::White, fstring);
}

My issue in simple words: how can i detect on failure with this structure?

pop!
Anyone have an answer for this? I need the same thing.