I am at a loss on how to trap exceptions with a GetAsync call.
If I initialize the JsonServiceClient _service variable with an invalid baseURI to test an inaccessible server and run this function, the code never hits return resp.Products, it is never trapped in the Catch. The same code structure with the .Get<> function traps the error in the Catch block.
I am sure it is something simple that I am unaware of however I have been digging through google results for hours and cant figure out what how to handle the exceptions.
public async Task<List<ProductsModel>> GetAllProducts()
{
try
{
var resp = await _service.GetAsync<ProductsResponse>("Products/" + App.pdClientGUID);
return resp.Products;
}
catch (Exception ex)
{
return null;
}
}
Thanks
M