Blob Blame History Raw

#include <cppunit/Portability.h>
#include <cppunit/Message.h>
#include <cppunit/SourceLine.h>
#include <exception>


/*! \brief Exceptions thrown by failed assertions.
 * \ingroup BrowsingCollectedTestResult
 * Exception is an exception that serves
 * descriptive strings through its what() method
class CPPUNIT_API Exception : public std::exception
  /*! \brief Constructs the exception with the specified message and source location.
   * \param message Message associated to the exception.
   * \param sourceLine Source location related to the exception.
  Exception( const Message &message = Message(), 
             const SourceLine &sourceLine = SourceLine() );

   * \deprecated Use other constructor instead.
  Exception( std::string  message, 
	     long lineNumber, 
	     std::string fileName );

  /*! \brief Constructs a copy of an exception.
   * \param other Exception to copy.
  Exception( const Exception &other );

  /// Destructs the exception
  virtual ~Exception() throw();

  /// Performs an assignment
  Exception &operator =( const Exception &other );

  /// Returns descriptive message
  const char *what() const throw();

  /// Location where the error occured
  SourceLine sourceLine() const;

  /// Message related to the exception.
  Message message() const;

  /// Set the message.
  void setMessage( const Message &message );

  /// The line on which the error occurred
  long lineNumber() const;

  /// The file in which the error occurred
  std::string fileName() const;

  static const std::string UNKNOWNFILENAME;
  static const long UNKNOWNLINENUMBER;

  /// Clones the exception.
  virtual Exception *clone() const;

  // VC++ does not recognize call to parent class when prefixed
  // with a namespace. This is a workaround.
  typedef std::exception SuperClass;

  Message m_message;
  SourceLine m_sourceLine;
  std::string m_whatMessage;