Handle http errors (4XX/5XX)

Everything is in the title.
Extra space here.