Boost logo

Boost Users :

From: Stephen Torri (storri_at_[hidden])
Date: 2007-02-25 09:40:11


I have an exception class that is not getting caught my
BOOST_CHECK_THROW. Here is a similar setup to what I have:

        class Base_Exception : public virtual std::exception {
        public:
        
                virtual ~Base_Exception() throw{}
        
                virtual const char* what () const throw() = 0;
        
                virtual const char* name () const throw() = 0;
        
                boost::uint32_t const& id () const throw();
        
        private:
        
                boost::uint32_t id;
        };
        
        
        class Child_Exception : public virtual Base_Exception {
        public:
        
                enum ERROR_ID {
                    INVALID_API_INPUT,
                    CANNOT_FIND_TARGET,
                    INTERNAL_LIBRARY_ERROR,
                };
        
                Child_Exception ( ERROR_ID message_id );
        
                virtual ~Child_Exception () throw () {}
        
                virtual const char* what () const throw();
        
                virtual const char* name () const throw();
        
        private:
        
                static const char* m_exception_name;
        
                static const char* m_messages[];
        };

I find that when I use the BOOST_CHECK_THROW ( expression,
Child_Exception ) that I still get the test crashing with an uncaught
exception. Here is the actual output:

        terminate called after throwing an instance of
        'libreverse::errors::API_Exception'
          what(): Internal library error has occurred. At this point
        consider the library unreliable.
        unknown location(0): fatal error in "test_wrong_sources":
        signal: SIGABRT (application abort requested)
        
        *** errors detected in test suite "Architecture Type Detector
        suite"; see standard output for details
        FAIL: test_arch_type_detector
        
I can send the whole test file but I hope this is enough to understand
the nature of the problem. Is there a FAQ about BOOST_CHECK_THROW?

Stephen


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net