Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8776453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:03:44+00:00 2026-06-13T19:03:44+00:00

I have the following code I have simplified: Thread two: boost::unique_future<void> future; TaskPtr task(new

  • 0

I have the following code I have simplified:

Thread two:

  boost::unique_future<void> future;
  TaskPtr task(new task::ReloadConfig(future));
  Listener::PushTask(task);
  future.wait();

  try
  {
    future.get();
  }
  catch (const cfg::ConfigError& e)
  {
    return cmd::Result::Okay;
  }

Thread two:

  try
  {
    cfg::UpdateShared(std::shared_ptr<cfg::Config>(new cfg::Config(configFile)));
  }
  catch (...) // should be cfg::ConfigError
  {
    promise.set_exception(boost::current_exception());
    return;
  }

  promise.set_value();

Instead of a the Cfg::ConfigError exception or one of its derived exceptions being propogated from thread two to thread one I get the following:

terminate called after throwing an instance of
‘boost::exception_detail::clone_impl’
what(): std::exception

Seems this other person had similar troubles and no answer:

https://stackoverflow.com/questions/10857834/how-to-use-boostfuture-get-to-get-user-defined-exception

I also get the following error if I try to use boost::enable_current_exception:

/usr/local/include/boost/exception/exception.hpp:419:20: error: no
matching function for call to ‘std::runtime_error::runtime_error()’

I can get the code working fine without exceptions, by just returning a boolean value, but this is a compromise.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:03:46+00:00Added an answer on June 13, 2026 at 7:03 pm

    I would try to do something like that in your thread two:

    catch (const cfg::ConfigError& e)
    {
        promise.set_exception(boost::make_exception_ptr(e));
    }
    

    Otherwise if you want that current_exception() to work you have to mess with things like:

    throw boost::enable_current_exception(cfg::ConfigError("meh")); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following (simplified) code periodically run by a Thread in the class
Imagine I have the following code (simplified regarding my real context of course): <div
I'm using gcc 4.3.2. I have the following code (simplified): #include <cstdlib> template<int SIZE>
I have following code <div id=main> <div id=one> </div> <div id=two> </div> <div id=three>
I have following code for updating user's column public void UpdateLastModifiedDate(string username) { using
I have the following code (simplified): ostringstream oss; oss << Text ; oss <<
I have the following code (as much simplified as possible): #include <vector> #include <algorithm>
I have the following code (asp.net-mvc, jquery) (i have simplified the example to show
I have the following code(simplified). public class OrderProcessor { public virtual string PlaceOrder(string test)
I have the following code: Note: I simplified the code as much as possible

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.