activemq-cpp-3.6.0
decaf::lang::Exception Class Reference

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

Inheritance diagram for decaf::lang::Exception:

Public Member Functions

 Exception ()
 Default Constructor.
 Exception (const Exception &ex)
 Copy Constructor.
 Exception (const std::exception *cause)
 Constructor.
 Exception (const char *file, const int lineNumber, const char *msg,...)
 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,...)
 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, copies one Exception to another.
- Public Member Functions inherited from decaf::lang::Throwable
 Throwable ()
virtual ~Throwable () throw ()

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

ExceptionData * data

Constructor & Destructor Documentation

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

Default Constructor.

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

Copy Constructor.

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

Constructor.

Parameters
causePointer to the exception that caused this one to be thrown, the caller must ensure that it passes a valid pointer as this object takes ownership of the exception.
decaf::lang::Exception::Exception ( const char *  file,
const int  lineNumber,
const char *  msg,
  ... 
)

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,
  ... 
)

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

virtual const std::exception* decaf::lang::Exception::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.

Implements decaf::lang::Throwable.

virtual std::string decaf::lang::Exception::getMessage ( ) const
virtual

Gets the message for this exception.

Returns
Text formatted error message

Implements decaf::lang::Throwable.

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, copies one Exception to another.

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::util::concurrent::ExecutorService::submit().

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

Sets the cause for this exception.

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

Implement method from std::exception.

Returns
the const char* of getMessage().

Field Documentation

ExceptionData* decaf::lang::Exception::data
protected

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