[Boost-bugs] [Boost C++ Libraries] #2821: Can not define custom description for boost::error_info

Subject: [Boost-bugs] [Boost C++ Libraries] #2821: Can not define custom description for boost::error_info
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-03-03 07:28:10


#2821: Can not define custom description for boost::error_info
--------------------------------------+-------------------------------------
 Reporter: paul.kolomiets_at_[hidden] | Owner: emildotchevski
     Type: Patches | Status: new
Milestone: To Be Determined | Component: exception
  Version: Boost 1.38.0 | Severity: Problem
 Keywords: |
--------------------------------------+-------------------------------------
 There is no way to make use of the error_info::value_as_string method
 override. I can create error_info descendants, but only base class copy
 will be committed in the exception storage by the << operator:

 {{{
 template <class E,class Tag,class T,class Base>
 inline
 E const &
 operator<<( E const & x, error_info<Tag,T> const & v )
 {
    typedef error_info<Tag,T> error_info_tag_t;
    shared_ptr<error_info_tag_t> p( new error_info_tag_t(v) );

    // Why new error_info_tag_t?
    // v can be another of another type.
    //...

 }}}

 See attached sample. It will describe os_error_info_tag as "10" instead of
 "Error code: 10".

 I've make a patch to solve this issue. It is rather ugly, but it works.
 Please review my changes. And can you let me know if you find better way
 to fix this issue? Thanks.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2821>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC