handle errors on link