Unhanded exception in win 8.1

Apr 29, 2015 at 12:07 PM
Hi I have a simple program which grabs and downloads a image.

On my PC at home it worked fine. But I have just tried it on win 8 and it is throwing a unhandled exception
  • Unhandled exception at 0x776F4598 in HTTP_try.exe: Microsoft C++ exception: web::http::http_exception at memory location 0x00D7F380.
I am really confused as it worked fine at home.

Any help would be appreciated.

Mark
Apr 29, 2015 at 12:31 PM
Edited Apr 29, 2015 at 12:32 PM
The simple program is ->

include "stdafx.h"

include <cpprest\http_client.h>

include <cpprest\filestream.h>

include <cpprest\http_listener.h>

include <cpprest\json.h>

include <cpprest\uri.h>

include <cpprest\ws_client.h>

include <cpprest\containerstream.h>

include <cpprest\interopstream.h>

include <cpprest\rawptrstream.h>

include <cpprest\producerconsumerstream.h>

using namespace utility;
using namespace web;
using namespace web::http;
using namespace web::http::client;
using namespace concurrency::streams;

using namespace web::http::experimental::listener;
using namespace web::experimental::web_sockets::client;
using namespace web::json;


int main(int argc, char* argv[])
{
auto filebuffer = std::make_shared<streambuf<uint8_t>>();
return file_buffer<uint8_t>::open(L"img2.txt", std::ios::out).then([=](streambuf<uint8_t>outfile) -> pplx::task < http_response >
{
    *filebuffer = outfile;

    http_client client(U("https://scontent-lhr.xx.fbcdn.net/hphotos-xpf1/v/t1.0-9/1622647_10154843142965191_5040285406931886118_n.jpg?oh=f8918f9bceb03f672a012cc8f031c59e&oe=559D7EE7"));
    return client.request(methods::GET);
})

    .then([=](http_response responce)->pplx::task < size_t >
{
    printf("responce code %u returned. \n", responce.status_code());
    return responce.body().read_to_end(*filebuffer);
})
    .then([=](size_t datasize)
{
    std::cout << datasize;
    return filebuffer->close();
}).wait();
return 0;

}
Apr 29, 2015 at 5:31 PM
Hi moonie87,

Our HTTP client library throws the http_exception if an error occurs. For example a networking error or connection timeout. Can you try catching the exception and taking a look at what the error is? There is an error string message and a std::error_code that you can take a look at.

Steve
Apr 29, 2015 at 6:40 PM
Hi Steve,

I believe it is because i was working on a network.

Cheers,

Mark