1
0
mirror of https://github.com/C9Glax/tranga.git synced 2025-04-18 14:23:18 +02:00

Exception handling on request failed HttpDownloadClient

This commit is contained in:
glax 2023-10-25 18:22:00 +02:00
parent 98d187d133
commit 38df54baff

@ -37,10 +37,17 @@ internal class HttpDownloadClient : DownloadClient
{
response = Client.Send(requestMessage);
}
catch (TaskCanceledException e)
catch (Exception e)
{
switch (e)
{
case TaskCanceledException:
Log($"Request timed out.\n\r{e}");
return new RequestResult(HttpStatusCode.RequestTimeout, null, Stream.Null);
case HttpRequestException:
Log($"Request failed\n\r{e}");
return new RequestResult(HttpStatusCode.BadRequest, null, Stream.Null);
}
}
}