Added a catch for HTTP errors
I now throw an HTTP error instead of a header