Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

Exceptions

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
csharpula csharp - 11 Mar 2008 16:50 GMT
Hello I got the following scenario:

Getting exception from some code unit :

catch (System.Exception ex)
           {
               throw new Exception("unable to load file project" , ex);
           }

This exception is being catched in the upper unit which called this code

catch (Exception ex)
{
Console.write ("error aaa")
}

I can see only the last console print and not the Inner exception. Is
there any way to build my exceptios in a way that I will see the full
exception without printing the inner one?
Thank you
Jon Skeet [C# MVP] - 11 Mar 2008 16:57 GMT
<snip>

> This exception is being catched in the upper unit which called this code
>
[quoted text clipped - 5 lines]
>
> I can see only the last console print and not the Inner exception.

Well the code above doesn't use *any* of the information about the
exception, beyond the fact that it happened at all.

> Is there any way to build my exceptios in a way that I will see the full
> exception without printing the inner one?

If you print ex.ToString(), you'll get all the stack traces and
messages.

Jon

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.