Implement exception handling.