Added debug print to API failure handler