Add an error handler for http status codes