Added in better error handling support for unexpected httpresponse codes