Add exception logging if URL generation fails