casacore
Modules | Classes

More...

Modules

 Exceptions_module_internal_classes
 Internal Exceptions_module classes and functions.
 

Classes

class  casacore::AipsError
  More...
 
class  casacore::AllocError
 Allocation errors. More...
 
class  casacore::IndexError
 Base class for all indexing errors. More...
 
class  casacore::indexError< t >
 Index errors returning the bad index. More...
 
class  casacore::DuplError
 Duplicate key errors. More...
 
class  casacore::duplError< t >
 Duplicate key errors where the bad key is returned. More...
 
class  casacore::SystemCallError
 Exception for an error in a system call. More...
 
class  casacore::AbortError
 Exception which halts execution. More...
 
class  casacore::InitError
 Initialization error, typically of static data shared between objects. More...
 

Detailed Description

Exception handling

See below for an overview of the classes in this module.

Review Status

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

Synopsis

This module provides the exception handling mechanism used in Casacore. It allows the user to define new exception types and to throw, catch, and rethrow these exceptions. The interface to this exception handling mechanism is very similary to the ANSI standard exceptions. This will make it easy to switch when the time comes.

This module supplies several (see (file="Error.h"))common exception types. These provide examples for creating new errors.

At some point, this exception mechanism will probably be replaced with compiler supported exceptions.

Example

This example shows how a more specific exception can be caught as a more general exception:

#include <casacore/casa/Exceptions.h>
#include <iostream>
main() {
try {
throw(indexError<int>(5,"Dummy error"));
} catch (IndexError xx) {
cout << "caught IndexError" << endl;
}
}