Exit more gracefully on error