Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Phoenix Exception Handling
From: Stuart Dootson (stuart.dootson_at_[hidden])
Date: 2011-06-12 14:23:11


Ticket #5604 raised for this feature request...

On 12 June 2011 10:57, Thomas Heller <thom.heller_at_[hidden]> wrote:

> On Friday, June 10, 2011 04:51:53 PM Stuart Dootson wrote:
> > I've been using Phoenix (the one that came with 1.44 - that's Phoenix
> v2?)
> > for a bit, as a Boost.Lambda replacement, mostly happily. But I've come
> > across a scenario I don't think Phoenix caters for, namely accessing an
> > exception from a catch_ body, something like this:
> >
> > std::vector<std::string> errors;
> > using namespace boost::phoenix;
> > using namespace boost::phoenix::arg_names;
> > std::for_each(changes.begin(), changes.end(),
> > try_
> > [
> > bind(&SomeClass::AddChange, this, arg1, std::string())
> > ]
> > .catch_<std::runtime_error>()
> > [
> > push_back(ref(errors), bind(&std::runtime_error::what, /* Can I
> access
> > the exceptin that's been thrown? */))
> > ]);
> >
> > I want to aggregate any error information thrown by SomeClass::AddChange
> in
> > the 'errors' vector, to be rethrown after the for_each. In Boost.Lambda,
> I'd
> > be able to use the '_e' placeholder to access the exception object, but
> > there seems to be no way of doing so in Phoenix?
> >
> > So, I'm just wondering if a) I've missed something, and b) is there any
> > likelihood of this being added into Phoenix v3 at some point?
>
> Yes, I can see the usefulnes of that feature, can you please add a feature
> request to trac?
>
> Regards,
> Thomas
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net