Throwing an exception from callback in WCF Async
I am using WCF Async calls in my project and i am using Client side asynchronous methods. I have a scenario like below -//Code in Business Layer and this method is called from Web layer
private void GetGeneralNews()
{
client.BeginGetGeneralNewsFeed(GeneralNewsCallback, null);
}
private static void GeneralNewsCallback(IAsyncResult asyncResult)
{
string response = string.Empty;
try
{
response = client.EndGetGeneralNewsFeed(asyncResult);
}
catch(Exception ex)
{
throw ex; // Here is the problem. It does not throw the exception to the web layer instead it will suppress the error.
}
}
So as shown in the above code snippet it does not throw the exception from business layer to web layer as it will be suppressed here in business layer itself.
Please give some ideas to proceed.
Thanks.