FITSError.h
Classes
- FITSError -- default FITS error handling function, typdef, and enumeration (full description)
Types
- WARN
-
- SEVERE
-
Interface
- Public Members
- static void defaultHandler(const char *errMessage, ErrorLevel severity)
Review Status
- Reviewed By:
- UNKNOWN
- Date Reviewed:
- before2004/08/25
Synopsis
FITSError contains the enumeration specifying the possible error
message levels. It also contains the default error handling function
for the FITS classes.
Example
This example shows how one could set up an error handler
which does what the FITS classes originally did - just
send the error message to cout without any indication as
to the severity of the error message.
void coutErrHandler(const char *errMessage, FITSError::ErrorLevel)
{ cout << errMessage << endl; }
FitsInput fin("myFile", FITS::Disk, 10, coutErrHandler);
Any error messages generated by fin will be sent to cout.
Error handlers for the HDUs would need to be indicated in
their constructors. For example:
PrimaryArray<Float> pa(fin, coutErrHandler);
The default error handler is FITSError::defaultHandler which
sends the error message to the global log sink at the
severity implied by ErrorLevel.
The error handler only handles the error messages. It is up to
the programmer to check for the error status of classes like
FitsInput.
Motivation
Originally, FITS error message were simply sent to an ostream. In
order to have these error messages go to the AIPS++ logger by default,
this class was added. This was made a separate class because both
BlockIo and FITS need to use this class. The anticipated replacements
for the current FITS classes use a somewhat similar scheme.
Member Description
WARN means that the FITS file is still usable - this generally
happens when parsing the HDU and some minor, recoverable
violation of the FITS rules is detected.
SEVERE means that a fatal error has occurred and the FITS file
can not be properly processed.
The default error handler. The errMessage is posted to
the global log sink at the severity implied by ErrorLevel.
It is assumed that errMessage is null terminated.