Пример #1
0
        public async Task TestRetryMonad429()
        {
            // This test demos how we can handle / retry exceptions using the try pattern.
            TryCatch <int> tryResult = await RetryHandler.Retry429 <int>(
                FunctionThatThrows429,
                maxRetryCount : 100,
                maxDelayInMilliseconds : 1000000);

            tryResult.Match(
                onSuccess: (result) =>
            {
                Console.WriteLine($"Got a result: {result}");
            },
                onError: (requestRateTooLargeException) =>
            {
                Console.WriteLine($"Got a 429: {requestRateTooLargeException}");
            });
        }