2
0

Fix crash when Request times out on ChromiumDownloadClient

This commit is contained in:
Glax 2024-01-31 18:30:57 +01:00
parent 31a4e693e0
commit 5d12be2983

View File

@ -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;
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;