Error.h
Classes
- AipsError -- Base class for all AIPS++ library errors (full description)
- AllocError -- Allocation errors (full description)
- IndexError -- Base class for all indexing errors (full description)
- indexError -- Index errors returning the bad index (full description)
- DuplError -- Duplicate key errors (full description)
- duplError -- Duplicate key errors where the bad key is returned (full description)
- AbortError -- Exception which halts execution (full description)
class AipsError: public std::exception
Types
- BOUNDARY
-
- INITIALIZATION
-
- INVALID_ARGUMENT
-
- CONFORMANCE
-
- ENVIRONMENT
-
- SYSTEM
-
- PERMISSION
-
- GENERAL
-
Interface
- Public Members
- virtual const char* what() const throw()
- const String &getMesg() const
- const AipsError::Category getCategory( ) const
- AipsError (const Char *str, Category c = GENERAL)
- AipsError (const String &str, Category c = GENERAL)
- AipsError (Category c = GENERAL) : message(), category(c)
- ~AipsError() throw()
Review Status
- Reviewed By:
- UNKNOWN
- Date Reviewed:
- before2004/08/25
Prerequisite
Synopsis
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.
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"));
To Do
Member Description
virtual const char* what() const throw()
Simply returns the stored error message.
Creates an AipsError and initializes the error message from
the parameter
Destructor which does nothing.
Interface
- AllocError(const Char *str, uInt sze) : sze(str,SYSTEM), Size(sze)
- AllocError(const String &str, uInt sze) : sze(str,SYSTEM), Size(sze)
- size_t size()
- ~AllocError() throw()
Review Status
- Reviewed By:
- UNKNOWN
- Date Reviewed:
- before2004/08/25
Synopsis
This class is used for allocation errors. It adds an extra
data item, the failed allocation size. Otherwise much the
same as AipsError.
Example
throw(AllocError("ANY STRING",1024));
To Do
Member Description
AllocError(const Char *str, uInt sze) : sze(str,SYSTEM), Size(sze)
AllocError(const String &str, uInt sze) : sze(str,SYSTEM), Size(sze)
This constructor takes the error message and the failed
allocation size.
size_t size()
This function returns the failed allocation size.
Destructor which does nothing.
Interface
- IndexError(const Char *str,Category c=BOUNDARY) : c(str,c)
- IndexError(const String &str,Category c=BOUNDARY) : c(str,c)
- IndexError(Category c=BOUNDARY) : BOUNDARY(c)
- ~IndexError() throw()
Review Status
- Reviewed By:
- UNKNOWN
- Date Reviewed:
- before2004/08/25
Synopsis
This class is the base class of all IndexErrors. It is
defined to allow the user to catch any of the many kinds of IndexErrors
which may be thrown. It can also be thrown itself if returning
the illegal index value is unimportant.
Example
throw(IndexError("ANY STRING"));
To Do
Member Description
IndexError(const Char *str,Category c=BOUNDARY) : c(str,c)
IndexError(const String &str,Category c=BOUNDARY) : c(str,c)
IndexError(Category c=BOUNDARY) : BOUNDARY(c)
Creates an GeneralIndexError and initializes the error message from
the parameter
Destructor which does nothing.
Interface
- indexError(t oI, const Char *str, Category c=BOUNDARY)
- indexError(t oI, const String &str, Category c=BOUNDARY)
- indexError(t oI, Category c=BOUNDARY) : IndexError(c), oIndex(oI)
- ~indexError() throw()
Review Status
- Reviewed By:
- UNKNOWN
- Date Reviewed:
- before2004/08/25
Synopsis
This class is templated to allow generalalized indexes to be returned
with the error message i.e. the class is templated on the index type.
Example
throw(indexError<int>(3,"ANY STRING"));/
To Do
Member Description
indexError(t oI, const Char *str, Category c=BOUNDARY)
indexError(t oI, const String &str, Category c=BOUNDARY)
indexError(t oI, Category c=BOUNDARY) : IndexError(c), oIndex(oI)
This constructor takes the error message and the index
which cause the error to occur.
Destructor which does nothing.
Interface
- DuplError(Category c=BOUNDARY) : BOUNDARY(c)
- DuplError(const Char *str,Category c=BOUNDARY) : c(str,c)
- DuplError(const String &str,Category c=BOUNDARY) : c(str,c)
- ~DuplError() throw()
Review Status
- Reviewed By:
- UNKNOWN
- Date Reviewed:
- before2004/08/25
Synopsis
This class is the base class of all duplicate key errors. It is
defined to allow the user to catch any of the many kinds of DuplErrors
which may be thrown. It can also be thrown itself if returning
the illegal key is unimportant.
Example
throw(DuplError("ANY STRING"));
To Do
Member Description
DuplError(Category c=BOUNDARY) : BOUNDARY(c)
DuplError(const Char *str,Category c=BOUNDARY) : c(str,c)
DuplError(const String &str,Category c=BOUNDARY) : c(str,c)
Creates an DuplError and initializes the error message from
the parameter
Destructor which does nothing.
Interface
- duplError(t oI, const Char *str,Category c=BOUNDARY)
- duplError(t oI, const String &str,Category c=BOUNDARY)
- duplError(t oI,Category c=BOUNDARY) : DuplError(c), oKey(oI)
- ~duplError() throw()
Review Status
- Reviewed By:
- UNKNOWN
- Date Reviewed:
- before2004/08/25
Synopsis
This template is for generalized duplicate key errors where the template
type parameter is the type of the key which caused the error. Because this
class is derived from DuplError
, the user to catch all duplicate key errors with one catch
statement.
Example
throw(duplError(4,"ANY STRING"));
To Do
Member Description
duplError(t oI, const Char *str,Category c=BOUNDARY)
duplError(t oI, const String &str,Category c=BOUNDARY)
duplError(t oI,Category c=BOUNDARY) : DuplError(c), oKey(oI)
This constructs a "duplError" for the offending key, and an
optional character string.
Destructor which does nothing.
Interface
- AbortError(const Char *str,Category c=GENERAL)
- AbortError(const String &str,Category c=GENERAL)
- ~AbortError() throw()
Review Status
- Reviewed By:
- UNKNOWN
- Date Reviewed:
- before2004/08/25
Synopsis
This error causes an execution to halt regardless. It
causes execution to halt before the exception can be caught.
Example
throw(AbortError("ANY STRING"));
To Do
Member Description
This constructs a "AbortError" from the error message.
Destructor which does nothing.