Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

base::Exception Class Reference

Base exception. More...

#include <libppbase/base/Exception.h>

Inheritance diagram for base::Exception:
base::ConfigException base::IOException base_crypto::CryptoException base_soap::SOAPException

List of all members.

Public Member Functions

 Exception (const char *fmt,...)
 Constructor.
virtual ~Exception () throw ()
 Destructor.
void appendMessage (const String &msg)
 Appends to the exception message.
int getErrcode () const
 Gets the error code.
const StringgetLocation () const
 Gets the code location where the exception occurred.
const StringgetMessage () const
 Gets the application-defined message.
const StringgetNested () const
 Gets the nested exception.
const StringgetStacktrace () const
 Gets the whole stack trace.
const StringgetType () const
 Gets the exception type.
virtual String toString () const
 Gets the string representation of this exception.
const char * what () const throw ()
 Gets the string representation of this exception.
Exceptionoperator= (const Exception &ex)
 Assignment operator.

Static Public Member Functions

static void trace (String &location, String &stacktrace)
 Gets the stack trace for the current thread or process.

Protected Member Functions

 Exception (int errcode, const char *type)
 Constructor for subclassing only.

Protected Attributes

int _errcode
 application-defined error code
String _location
 code location where the exception occurred, taken from the stack trace
String _message
 error message
String _nested
 nested exception
String _stacktrace
 the entire stack trace
String _type
 the exception type (name of subclass)

Detailed Description

Base exception.

Author:
Christoph Schwarz
Version:
$Id: Exception.h 21 2010-09-05 04:18:17Z cschwarz1 $

Constructor & Destructor Documentation

base::Exception::Exception ( const char *  fmt,
  ... 
) [explicit]

Constructor.

Parameters:
fmt printf-like format string to take an additional error message
... additional arguments for the format string
base::Exception::Exception ( int  errcode,
const char *  type 
) [protected]

Constructor for subclassing only.

Parameters:
errcode the error code
type the exception type (=name of subclass)

Member Function Documentation

int base::Exception::getErrcode (  )  const

Gets the error code.

Returns:
the error code
const String& base::Exception::getLocation (  )  const

Gets the code location where the exception occurred.

Returns:
the code location (taken from the stack trace)
const String& base::Exception::getMessage (  )  const

Gets the application-defined message.

Returns:
the appication-defined message
const String& base::Exception::getNested (  )  const

Gets the nested exception.

Returns:
the nested exception
const String& base::Exception::getStacktrace (  )  const

Gets the whole stack trace.

Returns:
the stack trace
const String& base::Exception::getType (  )  const

Gets the exception type.

Returns:
the exception type
Exception& base::Exception::operator= ( const Exception ex  ) 

Assignment operator.

This operator is required for MSVC 6, when assigning an exception to another one. Without this operator, the assignment operator of the superclass (std::exception) would be used, so that the members of this object are assigned strange values.

Parameters:
ex the source exception
Returns:
this object
virtual String base::Exception::toString (  )  const [virtual]

Gets the string representation of this exception.

Returns:
string representation (for logging purposes)

Reimplemented in base::IOException, and base_crypto::CryptoException.

static void base::Exception::trace ( String location,
String stacktrace 
) [static]

Gets the stack trace for the current thread or process.

Parameters:
location returns the location of the current thread or process
stacktrace returns the stack trace of the current thread or process
const char* base::Exception::what (  )  const throw ()

Gets the string representation of this exception.

Reimplementation of the what() method in std::exception

Returns:
a C-style character string describing the general cause of the current error

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