Handle http errors (4XX/5XX)