adding try for loop to log if it fails