?
Solved

Rethrowing exception from a thread

Posted on 2008-06-15
1
Medium Priority
?
806 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 500 total points
ID: 21790010
Try to invoke an event instead. Declare an event and invoke it instead of throwing an exception
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

762 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