CheckError Function

public function CheckError(checkpoint, line, file, rcValue, msg, rcToReturn)

Arguments

Type IntentOptional Attributes Name
logical, intent(in) :: checkpoint
integer, intent(in) :: line
character(len=*), intent(in) :: file
integer, intent(in) :: rcValue
character(len=*), intent(in) :: msg
integer, intent(out) :: rcToReturn

Return Value logical


Source Code

  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