add error handling on doHttp

this way if there's an http exception (host not there for example) you
get a null body and the error object in a second argument to the
callback