Consolidate error handling and exit status