public subroutine json_print_error_message(io_unit)
Arguments
Type |
Intent | Optional |
Attributes | | Name | |
integer, |
intent(in), |
optional |
| :: |
io_unit | |
Description
Print any error message, and then clear the exceptions.
Note
This routine is used by the unit tests.
It was originally in json_example.f90, and was
moved here 2/26/2015 by Izaak Beekman.
Variables
Type | Visibility |
Attributes | | Name | | Initial | |
character(kind=CK,len=:), |
public, |
allocatable | :: |
error_msg | | | |
logical, |
public |
| :: |
status_ok | | | |
Source Code
subroutine json_print_error_message(io_unit)
implicit none
integer, intent(in), optional :: io_unit
character(kind=CK,len=:),allocatable :: error_msg
logical :: status_ok
!get error message:
call json_check_for_errors(status_ok, error_msg)
!print it if there is one:
if (.not. status_ok) then
if (present(io_unit)) then
write(io_unit,'(A)') error_msg
else
write(*,'(A)') error_msg
end if
deallocate(error_msg)
call json_clear_exceptions()
end if
end subroutine json_print_error_message