Error
-
group
harp_error
With a few exceptions almost all HARP functions return an integer that indicate whether the function was able to perform its operations successfully. The return value will be 0 on success and -1 otherwise. In case you get a -1 you can look at the global variable harp_errno for a precise error code. Each error code and its meaning is described in this section. You will also be able to retrieve a character string with an error description via the harp_errno_to_string() function. This function will return either the default error message for the error code, or a custom error message. A custom error message will only be returned if the error code you pass to harp_errno_to_string() is equal to the last error that occurred and if this last error was set with a custom error message. The HARP error state can be set with the harp_set_error() function.
Error values
-
HARP_SUCCESS
Success (no error).
-
HARP_ERROR_OUT_OF_MEMORY
Out of memory.
-
HARP_ERROR_HDF4
An error occurred in the HDF4 library.
-
HARP_ERROR_HDF5
An error occurred in the HDF5 library.
-
HARP_ERROR_NETCDF
An error occurred in the netCDF library.
-
HARP_ERROR_CODA
An error occurred in the CODA library.
-
HARP_ERROR_FILE_NOT_FOUND
File not found.
-
HARP_ERROR_FILE_OPEN
Could not open file.
-
HARP_ERROR_FILE_CLOSE
Could not close file.
-
HARP_ERROR_FILE_READ
Could not read data from file.
-
HARP_ERROR_FILE_WRITE
Could not write data to file.
-
HARP_ERROR_INVALID_ARGUMENT
Invalid argument.
-
HARP_ERROR_INVALID_INDEX
Invalid index argument.
-
HARP_ERROR_INVALID_NAME
Invalid name argument.
-
HARP_ERROR_INVALID_FORMAT
Invalid format in argument.
-
HARP_ERROR_INVALID_DATETIME
Invalid date/time argument.
-
HARP_ERROR_INVALID_TYPE
Invalid type.
-
HARP_ERROR_ARRAY_NUM_DIMS_MISMATCH
Incorrect number of dimensions argument.
-
HARP_ERROR_ARRAY_OUT_OF_BOUNDS
Array index out of bounds.
-
HARP_ERROR_VARIABLE_NOT_FOUND
Variable not found.
-
HARP_ERROR_UNIT_CONVERSION
An error occured in the unit conversion.
-
HARP_ERROR_PRODUCT
There was an error detected in the product.
-
HARP_ERROR_SCRIPT
There was an error detected in the script.
-
HARP_ERROR_SCRIPT_SYNTAX
There is a syntax error in the script.
-
HARP_ERROR_INGESTION
There was an error in the ingestion of a data product.
-
HARP_ERROR_INGESTION_OPTION_SYNTAX
There was a syntax error in the ingestion option.
-
HARP_ERROR_INVALID_INGESTION_OPTION
The ingestion option is not valid for this ingestion.
-
HARP_ERROR_INVALID_INGESTION_OPTION_VALUE
The ingestion option has value that is not valid for this option.
-
HARP_ERROR_NO_DATA
The operation resulted in an ‘empty’ product.
Functions
-
void
harp_add_error_message
(const char *message, ...) Extend the current error message with additional information.
- Parameters
message
-Error message using printf() format.
-
void
harp_set_error
(int err, const char *message, ...) Set the error value and optionally set a custom error message. If message is NULL then the default error message for the error number will be used.
- Parameters
err
-Value of harp_errno.
message
-Optional error message using printf() format.
-
const char *
harp_errno_to_string
(int err) Returns a string with the description of the HARP error. If err equals the current HARP error status then this function will return the error message that was last set using harp_set_error(). If the error message argument to harp_set_error() was NULL or if err does not equal the current HARP error status then the default error message for err will be returned.
- Return
- String with a description of the HARP error.
- Parameters
err
-Value of harp_errno.
Variables
-
int
harp_errno
Variable that contains the error type. If no error has occurred the variable contains HARP_SUCCESS (0).
-