
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: try { try { throw my_error().add_info<tag_errno>(errno).add_info<tag_foo>(foo); } catch( boost::exception & x ) { x.add_info<tag_file_name>(file_name); throw; } } catch( my_error & x ) { if( int const * errnum = x.get_info<tag_errno>() ) std::cerr << "Error code: " << (*errnum); } Best regards, Robert