activemq-cpp-3.4.0

decaf::lang::Exception Class Reference

#include <src/main/decaf/lang/Exception.h>

Inheritance diagram for decaf::lang::Exception:

Public Member Functions

 Exception () throw ()
 Default Constructor.
 Exception (const Exception &ex) throw ()
 Copy Constructor.
 Exception (const std::exception *cause) throw ()
 Constructor.
 Exception (const char *file, const int lineNumber, const char *msg,...) throw ()
 Constructor - Initializes the file name and line number where this message occurred.
 Exception (const char *file, const int lineNumber, const std::exception *cause, const char *msg,...) throw ()
 Constructor - Initializes the file name and line number where this message occurred.
virtual ~Exception () throw ()
virtual std::string getMessage () const
 Gets the message for this exception.
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 void initCause (const std::exception *cause)
 Initializes the contained cause exception with the one given.
virtual const char * what () const throw ()
 Implement method from std::exception.
virtual void setMessage (const char *msg,...)
 Sets the cause for this exception.
virtual void setMark (const char *file, const int lineNumber)
 Adds a file/line number to the stack trace.
virtual Exceptionclone () const
 Clones this exception.
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 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.
Exceptionoperator= (const Exception &ex)
 Assignment operator.

Protected Member Functions

virtual void setStackTrace (const std::vector< std::pair< std::string, int > > &trace)
virtual void buildMessage (const char *format, va_list &vargs)

Protected Attributes

std::string message
 The cause of this exception.
std::exception * cause
 The Exception that caused this one to be thrown.
std::vector< std::pair
< std::string, int > > 
stackTrace
 The stack trace.

Constructor & Destructor Documentation

decaf::lang::Exception::Exception ( ) throw ()

Default Constructor.

decaf::lang::Exception::Exception ( const Exception ex) throw ()

Copy Constructor.

Parameters:
exThe Exception instance to copy.
decaf::lang::Exception::Exception ( const std::exception *  cause) throw ()

Constructor.

Parameters:
causePointer to the exception that caused this one to be thrown, the object is cloned caller retains ownership.
decaf::lang::Exception::Exception ( const char *  file,
const int  lineNumber,
const char *  msg,
  ... 
) throw ()

Constructor - Initializes the file name and line number where this message occurred.

Sets the message to report, using an optional list of arguments to parse into the message

Parameters:
fileThe file name where exception occurs
lineNumberThe line number where the exception occurred.
msgThe message to report
...list of primitives that are formatted into the message
decaf::lang::Exception::Exception ( const char *  file,
const int  lineNumber,
const std::exception *  cause,
const char *  msg,
  ... 
) throw ()

Constructor - Initializes the file name and line number where this message occurred.

Sets the message to report, using an optional list of arguments to parse into the message

Parameters:
fileThe file name where exception occurs
lineNumberThe line number where the exception occurred.
causeThe exception that was the cause for this one to be thrown.
msgThe message to report
...list of primitives that are formatted into the message
virtual decaf::lang::Exception::~Exception ( ) throw () [virtual]

Member Function Documentation

virtual void decaf::lang::Exception::buildMessage ( const char *  format,
va_list &  vargs 
) [protected, virtual]
virtual Exception* decaf::lang::Exception::clone ( ) const [virtual]

Clones this exception.

This is useful for cases where you need to preserve the type of the original exception as well as the message. All subclasses should override.

Returns:
Copy of this Exception object

Implements decaf::lang::Throwable.

Reimplemented in activemq::exceptions::ActiveMQException, activemq::exceptions::BrokerException, activemq::exceptions::ConnectionFailedException, decaf::internal::net::ssl::openssl::OpenSSLSocketException, decaf::io::EOFException, decaf::io::InterruptedIOException, decaf::io::IOException, decaf::io::UnsupportedEncodingException, decaf::io::UTFDataFormatException, decaf::lang::exceptions::ClassCastException, decaf::lang::exceptions::IllegalArgumentException, decaf::lang::exceptions::IllegalMonitorStateException, decaf::lang::exceptions::IllegalStateException, decaf::lang::exceptions::IllegalThreadStateException, decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::InterruptedException, decaf::lang::exceptions::InvalidStateException, decaf::lang::exceptions::NullPointerException, decaf::lang::exceptions::NumberFormatException, decaf::lang::exceptions::RuntimeException, decaf::lang::exceptions::UnsupportedOperationException, decaf::net::BindException, decaf::net::ConnectException, decaf::net::HttpRetryException, decaf::net::MalformedURLException, decaf::net::NoRouteToHostException, decaf::net::PortUnreachableException, decaf::net::ProtocolException, decaf::net::SocketException, decaf::net::SocketTimeoutException, decaf::net::UnknownHostException, decaf::net::UnknownServiceException, decaf::net::URISyntaxException, decaf::nio::BufferOverflowException, decaf::nio::BufferUnderflowException, decaf::nio::InvalidMarkException, decaf::nio::ReadOnlyBufferException, decaf::security::cert::CertificateEncodingException, decaf::security::cert::CertificateException, decaf::security::cert::CertificateExpiredException, decaf::security::cert::CertificateNotYetValidException, decaf::security::cert::CertificateParsingException, decaf::security::GeneralSecurityException, decaf::security::InvalidKeyException, decaf::security::KeyException, decaf::security::KeyManagementException, decaf::security::NoSuchAlgorithmException, decaf::security::NoSuchProviderException, decaf::security::SignatureException, decaf::util::concurrent::BrokenBarrierException, decaf::util::concurrent::CancellationException, decaf::util::concurrent::ExecutionException, decaf::util::concurrent::RejectedExecutionException, decaf::util::concurrent::TimeoutException, decaf::util::ConcurrentModificationException, decaf::util::NoSuchElementException, decaf::util::zip::DataFormatException, and decaf::util::zip::ZipException.

virtual const std::exception* decaf::lang::Exception::getCause ( ) const [inline, 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.

Implements decaf::lang::Throwable.

virtual std::string decaf::lang::Exception::getMessage ( ) const [inline, virtual]

Gets the message for this exception.

Returns:
Text formatted error message

Implements decaf::lang::Throwable.

Referenced by activemq::exceptions::BrokerException::BrokerException().

virtual std::vector< std::pair< std::string, int> > decaf::lang::Exception::getStackTrace ( ) const [virtual]

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

The first item in the returned vector is the first point where the mark was set (e.g. where the exception was created).

Returns:
the stack trace.

Implements decaf::lang::Throwable.

virtual std::string decaf::lang::Exception::getStackTraceString ( ) const [virtual]

Gets the stack trace as one contiguous string.

Returns:
string with formatted stack trace data

Implements decaf::lang::Throwable.

virtual void decaf::lang::Exception::initCause ( const std::exception *  cause) [virtual]

Initializes the contained cause exception with the one given.

A copy is made to avoid ownership issues.

Parameters:
causeThe exception that was the cause of this one.

Implements decaf::lang::Throwable.

Exception& decaf::lang::Exception::operator= ( const Exception ex)

Assignment operator.

Parameters:
exconst reference to another Exception
virtual void decaf::lang::Exception::printStackTrace ( ) const [virtual]

Prints the stack trace to std::err.

Implements decaf::lang::Throwable.

virtual void decaf::lang::Exception::printStackTrace ( std::ostream &  stream) const [virtual]

Prints the stack trace to the given output stream.

Parameters:
streamthe target output stream.

Implements decaf::lang::Throwable.

virtual void decaf::lang::Exception::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__).

Implements decaf::lang::Throwable.

Referenced by decaf::lang::exceptions::NumberFormatException::NumberFormatException().

virtual void decaf::lang::Exception::setMessage ( const char *  msg,
  ... 
) [virtual]

Sets the cause for this exception.

Parameters:
msgthe format string for the msg.
...params to format into the string
virtual void decaf::lang::Exception::setStackTrace ( const std::vector< std::pair< std::string, int > > &  trace) [protected, virtual]
virtual const char* decaf::lang::Exception::what ( ) const throw () [inline, virtual]

Implement method from std::exception.

Returns:
the const char* of getMessage().

Field Documentation

std::exception* decaf::lang::Exception::cause [protected]

The Exception that caused this one to be thrown.

std::string decaf::lang::Exception::message [protected]

The cause of this exception.

std::vector< std::pair< std::string, int> > decaf::lang::Exception::stackTrace [protected]

The stack trace.


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