2.3 NF90_STRERROR
The function NF90_STRERROR returns a static reference to an error
message string corresponding to an integer netCDF error status or to a
system error number, presumably returned by a previous call to some
other netCDF function. The list of netCDF error status codes is
available in the appropriate include file for each language binding.
Usage
function nf90_strerror(ncerr)
integer, intent( in) :: ncerr
character(len = 80) :: nf90_strerror
NCERR- An error status that might have been returned from a previous call to
some netCDF function.
Errors
If you provide an invalid integer error status that does not
correspond to any netCDF error message or or to any system error
message (as understood by the system strerror function), NF90_STRERROR
returns a string indicating that there is no such error status.
Example
Here is an example of a simple error handling function that uses
NF90_STRERROR to print the error message corresponding to the netCDF
error status returned from any netCDF function call and then exit:
subroutine handle_err(status)
integer, intent ( in) :: status
if(status /= nf90_noerr) then
print *, trim(nf90_strerror(status))
stop "Stopped"
end if
end subroutine handle_err