Add catch for thrown cuda exceptions to exit cleanly