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

This class represents an error that has occurred. More...

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

Inheritance diagram for decaf::lang::Throwable:

Public Member Functions

 Throwable ()
virtual ~Throwable () throw ()
virtual std::string getMessage () const =0
 Gets the cause of the error, if no message was provided to the instance of this interface but a cause was then the value cause.getMessage is then returned.
virtual const std::exception * getCause () const =0
 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)=0
 Initializes the contained cause exception with the one given.
virtual void setMark (const char *file, const int lineNumber)=0
 Adds a file/line number to the stack trace.
virtual Throwableclone () const =0
 Clones this exception.
virtual std::vector< std::pair
< std::string, int > > 
getStackTrace () const =0
 Provides the stack trace for every point where this exception was caught, marked, and rethrown.
virtual void printStackTrace () const =0
 Prints the stack trace to std::err.
virtual void printStackTrace (std::ostream &stream) const =0
 Prints the stack trace to the given output stream.
virtual std::string getStackTraceString () const =0
 Gets the stack trace as one contiguous string.

Detailed Description

This class represents an error that has occurred.

All Exceptions in the Decaf library should extend from this or from the Exception class in order to ensure that all Decaf Exceptions are interchangeable with the std::exception class.

Throwable can wrap another Throwable as the cause if the error being thrown. The user can inspect the cause by calling getCause, the pointer returned is the property of the Throwable instance and will be deleted when it is deleted or goes out of scope.

Since
1.0

Constructor & Destructor Documentation

decaf::lang::Throwable::Throwable ( )
virtual decaf::lang::Throwable::~Throwable ( ) throw ()
virtual

Member Function Documentation

virtual Throwable* decaf::lang::Throwable::clone ( ) const
pure 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

Implemented in decaf::lang::Exception, 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::Throwable::getCause ( ) const
pure 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.

Implemented in decaf::lang::Exception.

virtual std::string decaf::lang::Throwable::getMessage ( ) const
pure virtual

Gets the cause of the error, if no message was provided to the instance of this interface but a cause was then the value cause.getMessage is then returned.

Returns
string errors message

Implemented in decaf::lang::Exception.

virtual std::vector< std::pair< std::string, int> > decaf::lang::Throwable::getStackTrace ( ) const
pure virtual

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

Returns
vector containing stack trace strings

Implemented in decaf::lang::Exception.

virtual std::string decaf::lang::Throwable::getStackTraceString ( ) const
pure virtual

Gets the stack trace as one contiguous string.

Returns
string with formatted stack trace data

Implemented in decaf::lang::Exception.

virtual void decaf::lang::Throwable::initCause ( const std::exception *  cause)
pure 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.

Implemented in decaf::lang::Exception.

virtual void decaf::lang::Throwable::printStackTrace ( ) const
pure virtual

Prints the stack trace to std::err.

Implemented in decaf::lang::Exception.

virtual void decaf::lang::Throwable::printStackTrace ( std::ostream &  stream) const
pure virtual

Prints the stack trace to the given output stream.

Parameters
streamthe target output stream.

Implemented in decaf::lang::Exception.

virtual void decaf::lang::Throwable::setMark ( const char *  file,
const int  lineNumber 
)
pure 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).

Implemented in decaf::lang::Exception.


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