casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Static Public Member Functions | List of all members
casacore::FITSError Class Reference

default FITS error handling function, typdef, and enumeration More...

#include <FITSError.h>

Public Types

enum  ErrorLevel {
  INFO,
  WARN,
  SEVERE
}
 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. More...
 

Static Public Member Functions

static void defaultHandler (const char *errMessage, ErrorLevel severity)
 The default error handler. More...
 

Detailed Description

default FITS error handling function, typdef, and enumeration

Intended use:

Public interface

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 Casacore 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.

Definition at line 86 of file FITSError.h.

Member Enumeration Documentation

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.

Enumerator
INFO 
WARN 
SEVERE 

Definition at line 95 of file FITSError.h.

Member Function Documentation

static void casacore::FITSError::defaultHandler ( const char *  errMessage,
ErrorLevel  severity 
)
static

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.


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