NCL Website header
NCL Home > Documentation > HLUs > Classes

Error class

The Error class provides configuration options for the error reporting module of the HLU library.

Synopsis

Header file:		ncarg/hlu/hlu.h
Class name:		errorClass
Class pointer:		<Not referenceable>
Fortran class function:	<Not referenceable>
Superclass:		Base
Composite classes:	<None>

Name:			Error
Note: Only one error object is created for an hlu program, and it is always named Error.

Class-defined types

Type name:		NhlTErrorTypes
Definition:
typedef enum _NhlErrType{
	NhlFATAL	= -4,	/* "FATAL"	*/
	NhlWARNING	= -3,	/* "WARNING"	*/
	NhlINFO		= -2,	/* "INFO"	*/
	NhlNOERROR	= -1	/* "NOERROR"	*/
} NhlErrorTypes;

Resources

Local resources

+---------------------------------------------------------------+
|			Error resource set			|
|---------------------------------------------------------------|
| NAME				TYPE			ACCESS	|
|	CLASS				DEFAULT			|
|===============================================================|
| errBuffer			NhlTBoolean		RSG	|
|       ErrBuffer                       False                   |
|---------------------------------------------------------------|
| errLevel			NhlTErrorTypes		RSG	|
|	ErrLevel			NhlWARNING		|
|---------------------------------------------------------------|
| errPrint                      NhlTBoolean		RSG	|
|       ErrPrint                        True                    |
|---------------------------------------------------------------|
| errFileName			NhlTString		RSG	|
|	ErrFileName			"stderr"		|
|---------------------------------------------------------------|
| *errFilePtr			NhlTPointer		SG	|
|       ErrFilePtr                      NULL                    |
|---------------------------------------------------------------|
| **errUnitNumber		NhlTInteger		RSG	|
|	ErrUnitNumber			74			|
+---------------------------------------------------------------+
* errFilePtr is only valid in "C" mode.
** errUnitNumber is only valid in "Fortran" mode.

Description

This object is used to configure the error-reporting module of the HLU library. It works in conjunction with the HLU API Error functions.

The Error object works in two modes: C mode and Fortran mode. Most of the resources work the same in both modes. The errBuffer, errLevel, and errPrint resources are not affected by the language mode.

The language mode that the Error object uses is determined by how the HLU library is initialized. If the library is initialized using the Fortran initialization function NhlLFINITIALIZE, or NHLFOPEN, then the Error object uses Fortran mode; otherwise it uses C mode.

C mode

When in C mode, the Error object disables the errUnitNumber resource and uses the errFilePtr resource. If the errFilePtr resource is used, the errFileName resource is set to a NULL string.

Fortran mode

When in Fortran mode, the Error object disables the errFilePtr resource, and uses the errUnitNumber resource. If the errUnitNumber resource is set to a currently open unit, then the errFileName resource is set to NULL. If the unit is not currently open, then the Error object will attempt to open it with the name specified by the errFileName resource. If the errUnitNumber is not set, and the errFileName is set to either "stdout" or "stderr", then the appropriate unit numbers are used in place of the default. These are usually unit 6 and unit 0, respectively.


Support functions

The error-reporting support functions are described in the Error functions reference page.

See also