Added an exception handler.