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); } }
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); } }