Use C++ exceptions for error handling.