Set error message from curl error or http error when applicable