Next: , Previous: , Up: Use of the PnetCDF Library   [Index]


1.7 Error Handling

The netCDF library provides the facilities needed to handle errors in a flexible way. Each PnetCDF function returns an integer status value. If the returned status value indicates an error, you may handle it in any way desired, from printing an associated error message and exiting to ignoring the error indication and proceeding (not recommended!). For simplicity, the examples in this guide check the error status and call a separate function, handle_err(), to handle any errors. One possible definition of handle_err() can be found within the documentation of ncmpi_strerror (see ncmpi_strerror).

The ncmpi_strerror function is available to convert a returned integer error status into an error message string.

Occasionally, low-level I/O errors may occur in a layer below the PnetCDF library. For example, if a write operation causes you to exceed disk quotas or to attempt to write to a device that is no longer available, you may get an error from a layer below the PnetCDF library, but the resulting write error will still be reflected in the returned status value.


Next: , Previous: , Up: Use of the PnetCDF Library   [Index]