Add utility functions for error handling and exec