Results 1 to 5 of 5

Thread: how to create an instance of an exception?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2004
    Posts
    7

    Question how to create an instance of an exception?

    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

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Try to use Source method of the thrown exception obj .

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

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2004
    Posts
    7
    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".

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Umm , what does the error say ?

  5. #5
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    A shot in the dark really, but try
    Code:
    try {}
    catch (Exception ex)
    {
        System.Diagnostics.Debug.WriteLine(ex.InnerException.Source);
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width