handle error function for cuda