Boost logo

Boost :

Subject: Re: [boost] Are there any some utilities that helps to show where a exception is from?
From: Eric Niebler (eric_at_[hidden])
Date: 2008-10-22 01:18:40


Emil Dotchevski wrote:
>
> With Boost 1.37 (soon to be released), a new macro is introduced
> called BOOST_THROW_EXCEPTION. You use it like this:
>
> #include "boost/throw_exception.hpp"
>
> struct my_exception: std::exception { };
>
> BOOST_THROW_EXCEPTION(my_exception());
>
> It automatically records the throw location in the exception object.
> At the catch site, you can use boost::diagnostic_information to get a
> string that includes the throw location:
>
> #include "boost/exception/diagnostic_information.hpp"
>
> catch( my_exception & e )
> {
> std::cerr << boost::diagnostic_information(e);
> }

When I try this (on trunk) I get:

1>.\main.cpp(93) : error C2664: 'boost::diagnostic_information' : cannot
convert parameter 1 from 'my_exception' to 'const boost::exception &'
1> Reason: cannot convert from 'my_exception' to 'const
boost::exception'
1> No user-defined-conversion operator available that can perform
this conversion, or the operator cannot be called

???

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk