Exceptions

C

csharpula csharp

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
 
J

Jon Skeet [C# MVP]

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.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top