Boost logo

Boost :

From: Tom Brinkman (reportbase_at_[hidden])
Date: 2007-07-15 17:48:25


The proposed library by "Emil Dotchevski" needs a review manager.

The library is available here:
http://www.revergestudios.com/boost-exception/boost-exception.zip

The library is well documented, with samples and is packaged in the
boost folder structure. I havn't compiled the samples, but the
library appears to well done. I'm not an expert in exception handling
beyond having used "std::exception". However, This library appears
to be an interesting extension to the standard library and worthy of
consideration as a "boost" library

If no one volunteers to be the "review manager" within the next couple
of weeks, I'll volunteer and put it up for review in august.

This library has been in the reivew queue for at least nine months.
Thanks to the "Emil" for being patient.

I copied an interesting "snippit" from the libraries documentation.

<snippit>

Why bother with Boost Exception? When I design my exception class
hierarchy, I can ensure that the types I throw can pack all the
information available when I throw; I don't need boost::exception for
that.

    The problem is that exceptions are caught by the client code, and
you (the designer of the library that throws exceptions) cannot always
provide all the information that is necessary to format a meaningful
message for the user. Consider this Boost Exception usage:

    #include <boost/exception.hpp>
    #include <string>
    #include <stdio.h>

    class error: public boost::exception, public std::exception { };
    class io_error: public error { };
    class file_open_error: public io_error { };
    class file_read_error: public io_error { };
    class file_write_error: public io_error { };

    struct tag_io_source_name: boost::error_info_value<std::string> { };
    struct tag_io_destination_name: boost::error_info_value<std::string> { };

    //Throws file_open_error.
    boost::shared_ptr<FILE> file_open( char const * name, char const * mode );

    //Throws file_read_error, file_write_error.
    void copy_content( FILE * source, FILE * destination );

    void copy_file( char const * source, char const * destination )
    {
        boost::shared_ptr<FILE> f1 = file_open(source,"rb");
        boost::shared_ptr<FILE> f2 = file_open(destination,"wb");
        try
        {
            copy_content( f1.get(), f2.get() );
        }
        catch( boost::exception & x )
        {
            x <<
                boost::error_info<tag_io_source_name>(source) <<
                boost::error_info<tag_io_destination_name>(destination);
            throw;
        }
    }

</snippit>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk