Solved

Rethrowing exception from a thread

Posted on 2008-06-15
1
805 Views
Last Modified: 2012-03-15
Hi,

I created a web service that invokes  a thread that sends e-mails.
When the connection to the internet is terminated, this thread throws an exception.
I want to rethrow that exception to the client.
I tried to use the following code :

                         try
                        {
                            SmtpMail.Send(mailMessage);
                        }
                        catch (HttpException exc)
                        {
                            throw new HttpException(exc.GetHttpCode(), exc.Message);
                        }
but since we are in a thread, and nobody can catch the rethrown exception.
Please tell me how to throw an exception from a thread, so that it will can rethrown to the client.

Thanks
Michael
0
Comment
Question by:MichaelMarom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 13

Accepted Solution

by:
iHadi earned 125 total points
ID: 21790010
Try to invoke an event instead. Declare an event and invoke it instead of throwing an exception
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question