handle errors on server