activemq-cpp-3.9.5
cms::CMSException Class Reference

CMS API Exception that is the base for all exceptions thrown from CMS classes. More...

#include <src/main/cms/CMSException.h>

Inheritance diagram for cms::CMSException:

Public Member Functions

 CMSException ()
 
 CMSException (const CMSException &ex)
 
 CMSException (const std::string &message)
 
 CMSException (const std::string &message, const std::exception *cause)
 
 CMSException (const std::string &message, const std::exception *cause, const std::vector< std::pair< std::string, int > > &stackTrace)
 
virtual ~CMSException () throw ()
 
virtual std::string getMessage () const
 Gets the cause of the error.
 
virtual const std::exception * getCause () const
 Gets the exception that caused this one to be thrown, this allows for chaining of exceptions in the case of a method that throws only a particular exception but wishes to allow for the real causal exception to be passed only in case the caller knows about that type of exception and wishes to respond to it.
 
virtual std::vector< std::pair< std::string, int > > getStackTrace () const
 Provides the stack trace for every point where this exception was caught, marked, and rethrown.
 
virtual void setMark (const char *file, const int lineNumber)
 Adds a file/line number to the stack trace.
 
virtual void printStackTrace () const
 Prints the stack trace to std::err.
 
virtual void printStackTrace (std::ostream &stream) const
 Prints the stack trace to the given output stream.
 
virtual std::string getStackTraceString () const
 Gets the stack trace as one contiguous string.
 
virtual const char * what () const throw ()
 Overloads the std::exception what() function to return the cause of the exception.
 
virtual CMSExceptionclone ()
 Creates a cloned version of this CMSException instance.
 

Detailed Description

CMS API Exception that is the base for all exceptions thrown from CMS classes.

This class represents an error that has occurred in CMS, providers can wrap provider specific exceptions in this class by setting the cause to an instance of a provider specific exception provided it can be cast to an std::exception.

Since the contained cause exception is of type std::exception and the C++ exception class has no clone or copy method defined the contained exception can only be owned by one instance of an CMSException. To that end the class hands off the exception to each successive copy or clone so care must be taken when handling CMSException instances.

Since
1.0

Constructor & Destructor Documentation

◆ CMSException() [1/5]

cms::CMSException::CMSException ( )

Referenced by clone(), and CMSException().

◆ CMSException() [2/5]

cms::CMSException::CMSException ( const CMSException & ex)

References CMSException().

◆ CMSException() [3/5]

cms::CMSException::CMSException ( const std::string & message)

◆ CMSException() [4/5]

cms::CMSException::CMSException ( const std::string & message,
const std::exception * cause )

◆ CMSException() [5/5]

cms::CMSException::CMSException ( const std::string & message,
const std::exception * cause,
const std::vector< std::pair< std::string, int > > & stackTrace )

◆ ~CMSException()

virtual cms::CMSException::~CMSException ( )
throw ( )
virtual

Member Function Documentation

◆ clone()

virtual CMSException * cms::CMSException::clone ( )
virtual

Creates a cloned version of this CMSException instance.

This method passes on ownership of the contained cause exception pointer to the clone. This method is mainly useful to the CMS provider.

Returns
new pointer that is a clone of this Exception, caller owns.

Reimplemented in cms::CMSSecurityException, cms::IllegalStateException, cms::InvalidClientIdException, cms::InvalidDestinationException, cms::InvalidSelectorException, cms::MessageEOFException, cms::MessageFormatException, cms::MessageNotReadableException, cms::MessageNotWriteableException, cms::ResourceAllocationException, cms::TransactionInProgressException, cms::TransactionRolledBackException, cms::UnsupportedOperationException, and cms::XAException.

References clone(), CMSException(), and const.

Referenced by clone().

◆ getCause()

virtual const std::exception * cms::CMSException::getCause ( ) const
virtual

Gets the exception that caused this one to be thrown, this allows for chaining of exceptions in the case of a method that throws only a particular exception but wishes to allow for the real causal exception to be passed only in case the caller knows about that type of exception and wishes to respond to it.

Returns
a const pointer reference to the causal exception, if there was no cause associated with this exception then NULL is returned.

References const, and getCause().

Referenced by getCause().

◆ getMessage()

virtual std::string cms::CMSException::getMessage ( ) const
virtual

Gets the cause of the error.

Returns
string errors message

References const, and getMessage().

Referenced by getMessage().

◆ getStackTrace()

virtual std::vector< std::pair< std::string, int > > cms::CMSException::getStackTrace ( ) const
virtual

Provides the stack trace for every point where this exception was caught, marked, and rethrown.

Returns
vector containing stack trace strings

References const, and getStackTrace().

Referenced by getStackTrace().

◆ getStackTraceString()

virtual std::string cms::CMSException::getStackTraceString ( ) const
virtual

Gets the stack trace as one contiguous string.

Returns
string with formatted stack trace data

References const, and getStackTraceString().

Referenced by getStackTraceString().

◆ printStackTrace() [1/2]

virtual void cms::CMSException::printStackTrace ( ) const
virtual

Prints the stack trace to std::err.

References const, and printStackTrace().

Referenced by printStackTrace(), and printStackTrace().

◆ printStackTrace() [2/2]

virtual void cms::CMSException::printStackTrace ( std::ostream & stream) const
virtual

Prints the stack trace to the given output stream.

Parameters
streamthe target output stream.

References const, and printStackTrace().

◆ setMark()

virtual void cms::CMSException::setMark ( const char * file,
const int lineNumber )
virtual

Adds a file/line number to the stack trace.

Parameters
fileThe name of the file calling this method (use FILE).
lineNumberThe line number in the calling file (use LINE).

References const, and setMark().

Referenced by setMark().

◆ what()

virtual const char * cms::CMSException::what ( ) const
throw ( )
virtual

Overloads the std::exception what() function to return the cause of the exception.

Returns
const char pointer to error message

References const, and what().

Referenced by what().


The documentation for this class was generated from the following file: