logical function CheckError (checkpoint, line, file, rcValue, msg, rcToReturn)
logical, intent(in) :: checkpoint
integer, intent(in) :: line
character(len=*), intent(in) :: file
character(len=*), intent(in) :: msg
integer, intent(in) :: rcValue
integer, intent(out) :: rcToReturn
if (checkpoint) then
print '("checkpoint at line ", I5, " in file ", A)', line, file
end if
rcToReturn = ESMF_SUCCESS
CheckError = ESMF_LogFoundError (rcValue, msg=msg, rcToReturn=rcToReturn)
if (CheckError) then
print '("error detected at line ", I5, " in file ", A, " - return code = ", I8)', &
line, file, rcToReturn
print '(" ", A)', msg
end if
return
!-----------------------------------------------------------------------------
end function CheckError