private async Task<IEnumerable<Result>> searchresult(string searchText)
{
try
{
rootdata = await HttpClientJsonExtensions.GetFromJsonAsync<Rootdata>(httpClient,$"https://expressentry...");
}
catch (WebException ex)
{
}
addresslist = rootdata.d.Results.ToList();
return addresslist;
}
In this scenario, an unhandled error occurred in the browser and check on inspect shows
Failed to load resource:ERR_INTERNET_DISCONNECT
but I want to handle that exception.
Please help me.
Thanks
because you are trying to catch the error with
WebException
andERR_INTERNET_DISCONNECT
isHttpRequestException
changeWebException
toException
to get all exceptionssomething like this: