adds SF query error handling