$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Peter Dimov (pdimov_at_[hidden])
Date: 2022-02-15 03:28:29
Gavin Lambert wrote:
> But that's also a bit different from what I was envisaging -- why is it that you've
> modified the callback signature to carry the source_location across? Wouldn't
> this be better:
>
> void (*throw_handler)( std::exception const& ex, boost::exception& bx ) =
> default_throw_handler;
>
> void set_throw_handler( auto* p ) { throw_handler = p; }
>
> void default_throw_handler( std::exception const& ex, boost::exception&
> bx )
> {
> }
>
> template<class E> BOOST_NORETURN void throw_exception( E const & e )
> {
> wrapexcept<E> wx( e );
> throw_handler( e, wx );
> throw wx;
> }
>
> template<class E> BOOST_NORETURN void throw_exception( E const & e,
> boost::source_location const & loc )
> {
> wrapexcept<E> wx( e );
> wx.set_location( loc );
> throw_handler( e, wx );
> throw wx;
> }
Yeah, I made a mistake with calling the handler with `e`, it should have been
`wx` in both places.
Yes, that works too. My idea was to allow the user to _not_ put the source
location into `bx` but we might as well let him clear it if needed (and obtain
it from there for logging etc.)