From 5d12be2983106caeaf51db75acc0958c961a9cb7 Mon Sep 17 00:00:00 2001 From: Glax Date: Wed, 31 Jan 2024 18:30:57 +0100 Subject: [PATCH] Fix crash when Request times out on ChromiumDownloadClient --- Tranga/MangaConnectors/ChromiumDownloadClient.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Tranga/MangaConnectors/ChromiumDownloadClient.cs b/Tranga/MangaConnectors/ChromiumDownloadClient.cs index 78a1534..cf8f1fd 100644 --- a/Tranga/MangaConnectors/ChromiumDownloadClient.cs +++ b/Tranga/MangaConnectors/ChromiumDownloadClient.cs @@ -62,8 +62,17 @@ internal class ChromiumDownloadClient : DownloadClient { IPage page = this.browser.NewPageAsync().Result; page.DefaultTimeout = 10000; - IResponse response = page.GoToAsync(url, WaitUntilNavigation.Networkidle0).Result; - Log("Page loaded."); + IResponse response; + try + { + response = page.GoToAsync(url, WaitUntilNavigation.Networkidle0).Result; + Log("Page loaded."); + } + catch (Exception e) + { + Log($"Could not load Page:\n{e.Message}"); + return new RequestResult(HttpStatusCode.InternalServerError, null, Stream.Null); + } Stream stream = Stream.Null; HtmlDocument? document = null;