Boost logo

Boost Users :

Subject: Re: [Boost-users] Exception: adding diagnostic information from a dtor?
From: alfC (alfredo.correa_at_[hidden])
Date: 2011-06-15 22:02:44


On Jun 14, 2:45 pm, Michael Schuerig <michael.li..._at_[hidden]>
wrote:

> void foo(const string& file_name) {
>     try {
>         do_something_fallible(file_name);
>     } catch( boost::exception & e ) {
>         e << boost::errinfo_file_name(file_name);
>         throw;
>     }
>
> }
>
> I'd rather write it like this:
>
> void foo(const string& file_name) {
>     diagnostic<errinfo_file_name>(file_name);
>     do_something_fallible(file_name);
>
> }

sorry if I don't get the question right. can't you just do this?

> } catch( boost::exception & e ) {
> throw (e << boost::errinfo_file_name(file_name) );
> }


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