Boost logo

Boost :

From: Robert Kawulak (kawulak_at_[hidden])
Date: 2007-09-30 14:03:45

> From: Phil Endecott
> I'm not keen on the use of operator<< to add the data to the
> exceptions.
> If your code used a more conventional syntax, e.g.
> E.add_info<errno_tag>(errno);

Sounds like a good idea to me too. It could both simplify the interface (no
boost::error_info class and the << operator, just one template member function)
and make throw expressions shorter. This would also resolve the ambiguity
mentioned by Phil.

The boost::get_error_info could also be a member function for consistency, so
you would get:

      throw my_error().add_info<tag_errno>(errno).add_info<tag_foo>(foo);
   catch( boost::exception & x )
catch( my_error & x )
   if( int const * errnum = x.get_info<tag_errno>() )
      std::cerr << "Error code: " << (*errnum);

Best regards,

Boost list run by bdawes at, gregod at, cpdaniel at, john at