
On Mon, Feb 7, 2011 at 11:38 PM, Ilya Sokolov <ilyasokol@gmail.com> wrote:
On Tue, 08 Feb 2011 02:06:09 +0500, Steven Watanabe <watanabesj@gmail.com> wrote:
AMDG
Review part 2: implementation
[snip]
boost/process/config.hpp:
Can you use BOOST_THROW_EXCEPTION instead of rolling your own file/line info?
I think BOOST_PROCESS_SOURCE_LOCATION is my piece of code, which was written because BOOST_THROW_EXCEPTION didn't work (IIRC, there was a problem with BOOST_CURRENT_FUNCTION)
I'm not aware of any problems with BOOST_THROW_EXCEPTION or BOOST_CURRENT_FUNCTION. I'd suggest deriving the exception types from boost::exception, and using boost::error_info to indicate things like which system function failed, and any relevant information like executable file name: struct process_system_error: virtual boost::system::system_error, virtual boost::exception { }; BOOST_THROW_EXCEPTION(process_system_error()<<boost::errinfo_api_function("CreateProcess()")<<boost::errinfo_file_name(exe.get())); This not only makes the error info available for the user at the catch site, it'll also show up automatically in the string returned by boost::diagnostic_information()/current_exception_diagnostic_information(), along with the throw location, etc. Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode