class Poco::Exception
Overview
This is the base class for all exceptions defined in the Poco class library. Moreā¦
#include <Exception.h> class Exception: public exception { public: // construction Exception( const std::string& msg, int code = 0 ); Exception( const std::string& msg, const std::string& arg, int code = 0 ); Exception( const std::string& msg, const Exception& nested, int code = 0 ); Exception(const Exception& exc); // methods Exception& operator=(const Exception& exc); virtual const char* name() const; virtual const char* className() const; virtual const char* what() const; const Exception* nested() const; const std::string& message() const; int code() const; std::string displayText() const; virtual Exception* clone() const; virtual void rethrow() const; protected: // construction Exception(int code = 0); // methods void message(const std::string& msg); void extendedMessage(const std::string& arg); };
Detailed Documentation
This is the base class for all exceptions defined in the Poco class library.
Construction
Exception( const std::string& msg, int code = 0 )
Creates an exception.
Exception( const std::string& msg, const std::string& arg, int code = 0 )
Creates an exception.
Exception( const std::string& msg, const Exception& nested, int code = 0 )
Creates an exception and stores a clone of the nested exception.
Exception(const Exception& exc)
Copy constructor.
Exception(int code = 0)
Standard constructor.
Methods
Exception& operator=(const Exception& exc)
Assignment operator.
virtual const char* name() const
Returns a static string describing the exception.
virtual const char* className() const
Returns the name of the exception class.
virtual const char* what() const
Returns a static string describing the exception.
Same as name(), but for compatibility with std::exception.
const Exception* nested() const
Returns a pointer to the nested exception, or null if no nested exception exists.
const std::string& message() const
Returns the message text.
int code() const
Returns the exception code if defined.
std::string displayText() const
Returns a string consisting of the message name and the message text.
virtual Exception* clone() const
Creates an exact copy of the exception.
The copy can later be thrown again by invoking rethrow() on it.
virtual void rethrow() const
(Re)Throws the exception.
This is useful for temporarily storing a copy of an exception (see clone()), then throwing it again.
void message(const std::string& msg)
Sets the message for the exception.
void extendedMessage(const std::string& arg)
Sets the extended message for the exception.