Exception handling and debugging