Hi kisuya,
What is happening is you have an exception from a task going unobserved so it is being throw out of the destructor of the last task handle. This means you have an operation in your program with a task that doesn't have a call to wait(), get(), or a task-based continuation. From what you describe in sounds like you are using our http_client. Without seeing your code I'm guessing that right now you have a value-based continuation, which will not be executed if the parent task results in an exception. Your code probably looks something like this:
Thanks,
Steve
What is happening is you have an exception from a task going unobserved so it is being throw out of the destructor of the last task handle. This means you have an operation in your program with a task that doesn't have a call to wait(), get(), or a task-based continuation. From what you describe in sounds like you are using our http_client. Without seeing your code I'm guessing that right now you have a value-based continuation, which will not be executed if the parent task results in an exception. Your code probably looks something like this:
http_client client(...);
client.request(...).then([](http_response response)
{
// If an exception occurs from the task this continuation won't execute since there
// isn't a value to call this function with.
});
Instead try using a task-based continuation and add some logic to handle any exception that might occur. Our http library throws an exception of type http_exception that contains more information about the cause. It contains a std::error_code.http_client client(...);
client.request(...).then([](task<http_response> responseTask)
{
try
{
// Get the response out of the response task.
// This will throw an exception if an error occurred, for example if the connection was lost.
http_response response = responseTask.get();
} catch(const http_exception &e)
{
// inspect message and error code here and handle error
}
});
Once you can see the exception you should be able to see more information as to why sometimes a request is failing. Let us know if this helps or you are still stuck.Thanks,
Steve