Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 accessing inner exceptions in embedded try catch

Author  Topic 

rtutus
Aged Yak Warrior

522 Posts

Posted - 2007-02-27 : 23:21:32
when we have a global try catch and a lot of small try ctahes insode the code. How do I get the embeded error that causes an error if this exception is many levels inside the code?
Thanks

dfiala
Posting Yak Master

116 Posts

Posted - 2007-02-27 : 23:46:09
Walk the inner exception until can't walk any more....

Catch(Exception Ex)
{
Exception InnerMostException = Ex;
while(InnerMostException.InnerException != null)
{
InnerMostException = InnerMostException.InnerException;
}


}

Dean Fiala
Very Practical Software, Inc
Now with Blogging...
http://www.vpsw.com/blogbaby
Microsoft MVP
Go to Top of Page

rtutus
Aged Yak Warrior

522 Posts

Posted - 2007-03-01 : 10:35:15
good idea. Thank Dean
Go to Top of Page
   

- Advertisement -