Example #1
0
        private static async Task DownloadFromYoutube(Downloader downloader, IEnumerable <Type> exceptionTypes, IObserver <double> progress)
        {
            try
            {
                await Task.Run(() => downloader.Execute());
            }

            catch (Exception ex)
            {
                Exception outer = new YoutubeDownloadException("Youtube video or audio download failed", ex);

                if (exceptionTypes.Contains(ex.GetType()))
                {
                    progress.OnError(outer);
                }

                throw outer;
            }

            progress.OnCompleted();
        }
Example #2
0
        private static async Task DownloadFromYoutube(Downloader downloader, IEnumerable<Type> exceptionTypes, IObserver<double> progress)
        {
            try
            {
                await Task.Run(() => downloader.Execute());
            }

            catch (Exception ex)
            {
                Exception outer = new YoutubeDownloadException("Youtube video or audio download failed", ex);

                if (exceptionTypes.Contains(ex.GetType()))
                {
                    progress.OnError(outer);
                }

                throw outer;
            }

            progress.OnCompleted();
        }