PDA

Click to See Complete Forum and Search --> : how to create an instance of an exception?


byteArray
Feb 4th, 2004, 09:12 PM
Hi again!

I just want to know how to create an instance of an exception in my UI. Since all exceptions thrown by the web service are soap exception I can no longer get the real error that occur in the web service. My problem now is how can I know in what object did the error occured or what specifically is the exception.

I would really appreciate any help.

thanks!

byteArray

Pirate
Feb 5th, 2004, 02:38 AM
Try to use Source method of the thrown exception obj .


try
{

//Your code that errors out here
}
catch (Exception x)
{
MessageBox.Show("Error description " + x.Message +
" Error source " + x.Source );
}

byteArray
Feb 5th, 2004, 03:02 AM
Thanks for the help.

I've already tried to catch different exceptions using the format u've suggested but still it can't get the exact exception that occured in the web service because in the client the exceptions that I get are soap exceptions. And the value of the souce is always "System.Web.Service".

Pirate
Feb 5th, 2004, 03:24 AM
Umm , what does the error say ?

axion_sa
Feb 5th, 2004, 12:13 PM
A shot in the dark really, but try

try {}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.InnerException.Source);
}