diff --git a/src/Mangarr.Stack/Sources/Clients/CustomHttpClient.Get.cs b/src/Mangarr.Stack/Sources/Clients/CustomHttpClient.Get.cs index 67a65d7..6cd758f 100644 --- a/src/Mangarr.Stack/Sources/Clients/CustomHttpClient.Get.cs +++ b/src/Mangarr.Stack/Sources/Clients/CustomHttpClient.Get.cs @@ -108,7 +108,17 @@ public async Task> GetBuffer(string requestUri, CancellationToken public async Task> Get(string requestUri, CancellationToken ct = default) { HttpClient httpClient = CreateClient(); - using HttpResponseMessage response = await httpClient.SendAsync(CreateGetRequest(requestUri), ct); + HttpResponseMessage response; + + try + { + response = await httpClient.SendAsync(CreateGetRequest(requestUri), ct); + } + catch (Exception e) + { + return Result.Fail(new ExceptionalError(e)) + .WithReason(new UrlReason(requestUri)); + } try { @@ -145,7 +155,17 @@ public async Task> Get(string requestUri where TConcrete : TAbstract { HttpClient httpClient = CreateClient(); - using HttpResponseMessage response = await httpClient.SendAsync(CreateGetRequest(requestUri), ct); + HttpResponseMessage response; + + try + { + response = await httpClient.SendAsync(CreateGetRequest(requestUri), ct); + } + catch (Exception e) + { + return Result.Fail(new ExceptionalError(e)) + .WithReason(new UrlReason(requestUri)); + } try {