Nothing Special   »   [go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch block for boost::exception appears after std::exception in execution_monitor::execute() #147

Closed
k15tfu opened this issue May 23, 2018 · 7 comments

Comments

@k15tfu
Copy link
k15tfu commented May 23, 2018

So, if I throw myexception defined as struct myexception : std::exception, virtual boost::exception it prints uninformative message

@raffienficiaud
Copy link
Member

Give a snippet, define uninformative, and please read the contribution file on how to file a bug ticket.

@k15tfu
Copy link
Author
k15tfu commented May 24, 2018

If you prefer to use Boost Trac why you haven't disabled Issues tab on GitHub?

using error_code = boost::error_info<struct tag_error_code, uint32_t>;
struct myexception : std::exception, virtual boost::exception {};

BOOST_AUTO_TEST_CASE(is_always_lock_free) {
  BOOST_THROW_EXCEPTION(myexception << error_code(123));
}

At the moment the exception will be catch as std::exception:

test.cpp(66): fatal error: in "void __cdecl `anonymous-namespace'::is_always_lock_free::test_method(void)": class boost::exception_detail::clone_impl<struct myexception>: Unknown exception

Well.. I swapped the boost::exception && std::exception and the only difference was in showing "Unknown exception" message. Sorry, thought it will use boost::diagnostic_information() instead of unknown-exception phrase.

But isn't it right to catch more narrowed (non generic) exceptions first?

@raffienficiaud
Copy link
Member
raffienficiaud commented Sep 2, 2018

What happens if you derive only from boost::exception? and recently Trac has been closed to new tickets.

@raffienficiaud
Copy link
Member

@k15tfu Would you please test the branch topic/GH-147-boost-exception-before-std-exception?

raffienficiaud added a commit that referenced this issue Sep 29, 2018
… next-internal

* topic/GH-147-boost-exception-before-std-exception:
  Change log
  Catching boost::exception before std::exception
@raffienficiaud
Copy link
Member

In next

raffienficiaud added a commit that referenced this issue Oct 1, 2018
… develop

* topic/GH-147-boost-exception-before-std-exception:
  Change log
  Catching boost::exception before std::exception
@raffienficiaud
Copy link
Member

In develop, closing.

@k15tfu
Copy link
Author
k15tfu commented Mar 14, 2019

Tested, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants