Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/ModernHttpClient/Android/OkHttpNetworkHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using System.Security.Cryptography.X509Certificates;
using System.Globalization;
using Android.OS;
using Java.Net;

namespace ModernHttpClient
{
Expand Down Expand Up @@ -113,12 +114,16 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
throw new CaptiveNetworkException(new Uri(java_uri), new Uri(newUri.ToString()));
}
}
} catch (UnknownHostException ex) {
throw new HttpRequestException("Unknown host", ex);
} catch (IOException ex) {
if (ex.Message.ToLowerInvariant().Contains("canceled")) {
throw new OperationCanceledException();
throw new OperationCanceledException(ex.Message, ex);
}

throw;
throw new HttpRequestException(
ex.Message,
ex);
}

var respBody = resp.Body();
Expand Down