Exemplo n.º 1
0
 private static void Bar(Person person)
 {
     try
     {
         // person.ToString() triggers null reference exception.
         Console.WriteLine("Person: [{0}]", person.ToString());
     }
     catch (Exception ex)
     {
         throw new ApplicationException("Application exception thrown by Bar()", ex);
     }
 }
Exemplo n.º 2
0
 public static void Foo(Person person)
 {
     try
     {
         Console.WriteLine("This is foo.");
         Bar(person);
     }
     catch (ApplicationException ae)
     {
         throw new CustomException("Custom exception thrown by Foo()", ae);
     }
 }