Handle http errors (4XX/5XX)

Everything is in the title.