Exception handling on request failed HttpDownloadClient
This commit is contained in:
parent
98d187d133
commit
38df54baff
@ -37,10 +37,17 @@ internal class HttpDownloadClient : DownloadClient
|
|||||||
{
|
{
|
||||||
response = Client.Send(requestMessage);
|
response = Client.Send(requestMessage);
|
||||||
}
|
}
|
||||||
catch (TaskCanceledException e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log($"Request timed out.\n\r{e}");
|
switch (e)
|
||||||
return new RequestResult(HttpStatusCode.RequestTimeout, null, Stream.Null);
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user