casacore::AipsError Class Reference

Base class for all Casacore library errors. More...

#include <Error.h>

Inheritance diagram for casacore::AipsError:
casacore::AbortError casacore::AllocError casacore::ArrayError casacore::DataManError casacore::DFTError casacore::DuplError casacore::EmptyStackError casacore::FunctionFactoryError casacore::HDF5Error casacore::IndexError casacore::IterError casacore::MathFuncError casacore::MSSelectionError casacore::SortError casacore::SystemCallError casacore::TableError

List of all members.

Public Types

enum  Category {
  BOUNDARY,
  INITIALIZATION,
  INVALID_ARGUMENT,
  CONFORMANCE,
  ENVIRONMENT,
  SYSTEM,
  PERMISSION,
  GENERAL
}

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 void getLastInfo (String &message, String &stackTrace)
 Get or clear the stacktrace info.
static String getLastMessage ()
static String getLastStackTrace ()
static void clearLastInfo ()
static AipsError repackageAipsError (AipsError &error, const String &message, const char *file, Int line, const char *func)
 Repackage an exception.
static void throwIf (Bool condition, const String &message, const char *file, Int line, const char *func="")
 Throw if the condition is true.
static void throwIfError (Int errorCode, const String &prefix, const char *file, Int line, const char *func="")
 Throw if the system error code is not 0.

Protected Member Functions

void addStackTrace ()
 Add the stack trace to the message (if USE_STACKTRACE is set).

Protected Attributes

String message
Category category
String stackTrace

Detailed Description

Base class for all Casacore library errors.

Intended use:

Public interface

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25

Prerequisite

Synopsis

This is the base class for all of the Casacore 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;

Example

 throw(AipsError("SOME STRING"));

Definition at line 135 of file Error.h.


Member Enumeration Documentation

Enumerator:
BOUNDARY 
INITIALIZATION 
INVALID_ARGUMENT 
CONFORMANCE 
ENVIRONMENT 
SYSTEM 
PERMISSION 
GENERAL 

Definition at line 139 of file Error.h.


Constructor & Destructor Documentation

casacore::AipsError::AipsError ( const Char str,
Category  c = GENERAL 
)

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

casacore::AipsError::AipsError ( const String str,
Category  c = GENERAL 
)
casacore::AipsError::AipsError ( const String msg,
const String filename,
uInt  lineNumber,
Category  c = GENERAL 
)
casacore::AipsError::AipsError ( Category  c = GENERAL  ) 
casacore::AipsError::~AipsError (  )  throw ()

Destructor which does nothing.


Member Function Documentation

void casacore::AipsError::addStackTrace (  )  [protected]

Add the stack trace to the message (if USE_STACKTRACE is set).

static void casacore::AipsError::clearLastInfo (  )  [static]
AipsError::Category casacore::AipsError::getCategory (  )  const [inline]

Definition at line 152 of file Error.h.

References category.

static void casacore::AipsError::getLastInfo ( String message,
String stackTrace 
) [static]

Get or clear the stacktrace info.

static String casacore::AipsError::getLastMessage (  )  [static]
static String casacore::AipsError::getLastStackTrace (  )  [static]
const String& casacore::AipsError::getMesg (  )  const [inline]

Definition at line 149 of file Error.h.

References message.

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

String casacore::AipsError::getStackTrace (  )  const
static AipsError casacore::AipsError::repackageAipsError ( AipsError error,
const String message,
const char *  file,
Int  line,
const char *  func 
) [static]

Repackage an exception.

void casacore::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 157 of file Error.h.

References message.

static void casacore::AipsError::throwIf ( Bool  condition,
const String message,
const char *  file,
Int  line,
const char *  func = "" 
) [static]

Throw if the condition is true.

static void casacore::AipsError::throwIfError ( Int  errorCode,
const String prefix,
const char *  file,
Int  line,
const char *  func = "" 
) [static]

Throw if the system error code is not 0.

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

Simply returns the stored error message.

Definition at line 147 of file Error.h.

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


Member Data Documentation

Definition at line 205 of file Error.h.

Referenced by getCategory().

Definition at line 204 of file Error.h.

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

Definition at line 206 of file Error.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1