casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
casa::AipsError Class Reference

Base class for all AIPS++ library errors. More...

#include <Error.h>

Inheritance diagram for casa::AipsError:
casa::AbortError casa::AllocError casa::ArrayError casa::DataManError casa::DFTError casa::DuplError casa::EmptyStackError casa::FunctionFactoryError casa::HDF5Error casa::IndexError casa::IterError casa::MathFuncError casa::MPIError casa::MSSelectionError casa::SortError casa::SynthesisError casa::SystemCallError casa::TableError casa::ToLCRegionConversionError casa::utilj::AipsErrorTrace casa::WorldToPixelConversionError

List of all members.

Public Types

enum  Category {

Public Member Functions

virtual const char * what () const throw ()
 Simply returns the stored error message.
const StringgetMesg () const
String getStackTrace () const
AipsError::Category getCategory () const
void setMessage (const String &msg) const
 Append a message.
 AipsError (const Char *str, Category c=GENERAL)
 Creates an AipsError and initializes the error message from the parameter.
 AipsError (const String &str, Category c=GENERAL)
 AipsError (const String &msg, const String &filename, uInt lineNumber, Category c=GENERAL)
 AipsError (Category c=GENERAL)
 ~AipsError () throw ()
 Destructor which does nothing.

Static Public Member Functions

static String generateStackTrace ()
static void getLastInfo (String &message, String &stackTrace)
static String getLastMessage ()
static String getLastStackTrace ()
static void clearLastInfo ()
static String noMessage ()
static String noStackTrace ()

Protected Member Functions

void addStackTrace ()

Protected Attributes

String message
Category category
String stackTrace

Static Protected Attributes

static String lastMessage
static String lastStackTrace
static Mutex lastErrorMutex

Detailed Description

Base class for all AIPS++ library errors.

Intended use:

Public interface

Review Status

Reviewed By:
Date Reviewed:



This is the base class for all of the AIPS++ error classes. Because all of the errors have a common base class, any error can be caught with a single catch statement.

This class has a string which allows error messages to be propagated.

Tip: The string member must be handled very carefully because string is also derived from cleanup, thus the message;makePermanent() call in the implementation of the constructors; This prevents the String from being cleaned up in the middle of an exception;


         throw(AipsError("SOME STRING"));

Definition at line 89 of file Error.h.

Member Enumeration Documentation


Definition at line 93 of file Error.h.

Constructor & Destructor Documentation

casa::AipsError::AipsError ( const Char str,
Category  c = GENERAL 

Creates an AipsError and initializes the error message from the parameter.

casa::AipsError::AipsError ( const String str,
Category  c = GENERAL 
casa::AipsError::AipsError ( const String msg,
const String filename,
uInt  lineNumber,
Category  c = GENERAL 

Destructor which does nothing.

Member Function Documentation

void casa::AipsError::addStackTrace ( ) [protected]
static void casa::AipsError::clearLastInfo ( ) [static]

Definition at line 106 of file Error.h.

References category.

static void casa::AipsError::getLastInfo ( String message,
String stackTrace 
) [static]
const String& casa::AipsError::getMesg ( ) const [inline]

Definition at line 103 of file Error.h.

References message.

Referenced by casa::MSSelectionLogError::handleError().

static String casa::AipsError::noMessage ( ) [static]
void casa::AipsError::setMessage ( const String msg) const [inline]

Append a message.

This is used by LogIO when an exception is logged. The message is const to be able to use it for a temporary exception.

Definition at line 111 of file Error.h.

References message.

virtual const char* casa::AipsError::what ( ) const throw () [inline, virtual]

Simply returns the stored error message.

Definition at line 101 of file Error.h.

References casa::String::c_str(), and message.

Member Data Documentation

Definition at line 143 of file Error.h.

Referenced by getCategory().

Definition at line 148 of file Error.h.

String casa::AipsError::lastMessage [static, protected]

Definition at line 146 of file Error.h.

Definition at line 147 of file Error.h.

Definition at line 142 of file Error.h.

Referenced by getMesg(), setMessage(), and what().

Definition at line 144 of file Error.h.

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