Exiting on error should return -1