json_failed Function

private pure function json_failed(json) result(failed)

Logical function to indicate if an exception has been thrown in a json_core.

Example

    type(json_core) :: json
    type(json_value),pointer :: p
    logical :: status_ok
    character(len=:),allocatable :: error_msg
    call json%load(filename='myfile.json',p)
    if (json%failed()) then
        call json%check_for_errors(status_ok, error_msg)
        write(*,*) 'Error: '//error_msg
        call json%clear_exceptions()
        call json%destroy(p)
    end if

Note that json_file contains a wrapper for this routine, which is used like:

    type(json_file) :: f
    logical :: status_ok
    character(len=:),allocatable :: error_msg
    call f%load(filename='myfile.json')
    if (f%failed()) then
        call f%check_for_errors(status_ok, error_msg)
        write(*,*) 'Error: '//error_msg
        call f%clear_exceptions()
        call f%destroy()
    end if

See also

Type Bound

json_core

Arguments

Type IntentOptional Attributes Name
class(json_core), intent(in) :: json

Return Value logical(kind=LK)

will be true if an exception has been thrown.


Called by

proc~~json_failed~~CalledByGraph proc~json_failed json_core%json_failed proc~assign_json_file_to_string json_file%assign_json_file_to_string proc~assign_json_file_to_string->proc~json_failed proc~json_value_to_string json_core%json_value_to_string proc~assign_json_file_to_string->proc~json_value_to_string proc~assign_string_to_json_file json_file%assign_string_to_json_file proc~assign_string_to_json_file->proc~json_failed proc~hash_table_create_from_value json_hash_table%hash_table_create_from_value proc~hash_table_create_from_value->proc~json_failed proc~json_file_failed json_file%json_file_failed proc~json_file_failed->proc~json_failed proc~json_file_update_integer json_file%json_file_update_integer proc~json_file_update_integer->proc~json_failed proc~json_file_update_logical json_file%json_file_update_logical proc~json_file_update_logical->proc~json_failed proc~json_file_update_real json_file%json_file_update_real proc~json_file_update_real->proc~json_failed proc~json_file_update_string json_file%json_file_update_string proc~json_file_update_string->proc~json_failed proc~json_value_print json_core%json_value_print proc~json_value_print->proc~json_failed proc~json_value_print->proc~json_value_print proc~json_value_validate json_core%json_value_validate proc~json_value_validate->proc~json_failed proc~initialize_hash json_file%initialize_hash proc~initialize_hash->proc~hash_table_create_from_value none~get json_file%get proc~initialize_hash->none~get proc~json_file_get_alloc_string_vec json_file%json_file_get_alloc_string_vec proc~json_file_get_alloc_string_vec->proc~json_file_failed proc~json_file_get_alloc_string_vec->none~get proc~json_file_get_integer json_file%json_file_get_integer proc~json_file_get_integer->proc~json_file_failed proc~json_file_get_integer->none~get proc~json_file_get_integer_vec json_file%json_file_get_integer_vec proc~json_file_get_integer_vec->proc~json_file_failed proc~json_file_get_integer_vec->none~get proc~json_file_get_logical json_file%json_file_get_logical proc~json_file_get_logical->proc~json_file_failed proc~json_file_get_logical->none~get proc~json_file_get_logical_vec json_file%json_file_get_logical_vec proc~json_file_get_logical_vec->proc~json_file_failed proc~json_file_get_logical_vec->none~get proc~json_file_get_real json_file%json_file_get_real proc~json_file_get_real->proc~json_file_failed proc~json_file_get_real->none~get proc~json_file_get_real_vec json_file%json_file_get_real_vec proc~json_file_get_real_vec->proc~json_file_failed proc~json_file_get_real_vec->none~get proc~json_file_get_string json_file%json_file_get_string proc~json_file_get_string->proc~json_file_failed proc~json_file_get_string->none~get proc~json_file_get_string_vec json_file%json_file_get_string_vec proc~json_file_get_string_vec->proc~json_file_failed proc~json_file_get_string_vec->none~get proc~json_file_move_pointer json_file%json_file_move_pointer proc~json_file_move_pointer->proc~json_file_failed proc~json_print_to_unit json_core%json_print_to_unit proc~json_print_to_unit->proc~json_value_print proc~json_value_to_string->proc~json_value_print proc~wrap_assign_string_to_json_file json_file%wrap_assign_string_to_json_file proc~wrap_assign_string_to_json_file->proc~assign_string_to_json_file none~get->proc~json_file_get_alloc_string_vec none~get->proc~json_file_get_integer none~get->proc~json_file_get_integer_vec none~get->proc~json_file_get_logical none~get->proc~json_file_get_logical_vec none~get->proc~json_file_get_real none~get->proc~json_file_get_real_vec none~get->proc~json_file_get_string none~get->proc~json_file_get_string_vec proc~json_file_get_real32 json_file%json_file_get_real32 none~get->proc~json_file_get_real32 proc~json_file_get_real32_vec json_file%json_file_get_real32_vec none~get->proc~json_file_get_real32_vec proc~wrap_json_file_get_alloc_string_vec json_file%wrap_json_file_get_alloc_string_vec none~get->proc~wrap_json_file_get_alloc_string_vec proc~wrap_json_file_get_integer json_file%wrap_json_file_get_integer none~get->proc~wrap_json_file_get_integer proc~wrap_json_file_get_integer_vec json_file%wrap_json_file_get_integer_vec none~get->proc~wrap_json_file_get_integer_vec proc~wrap_json_file_get_logical json_file%wrap_json_file_get_logical none~get->proc~wrap_json_file_get_logical proc~wrap_json_file_get_logical_vec json_file%wrap_json_file_get_logical_vec none~get->proc~wrap_json_file_get_logical_vec proc~wrap_json_file_get_object json_file%wrap_json_file_get_object none~get->proc~wrap_json_file_get_object proc~wrap_json_file_get_real json_file%wrap_json_file_get_real none~get->proc~wrap_json_file_get_real proc~wrap_json_file_get_real32 json_file%wrap_json_file_get_real32 none~get->proc~wrap_json_file_get_real32 proc~wrap_json_file_get_real32_vec json_file%wrap_json_file_get_real32_vec none~get->proc~wrap_json_file_get_real32_vec proc~wrap_json_file_get_real_vec json_file%wrap_json_file_get_real_vec none~get->proc~wrap_json_file_get_real_vec proc~wrap_json_file_get_string json_file%wrap_json_file_get_string none~get->proc~wrap_json_file_get_string proc~wrap_json_file_get_string_vec json_file%wrap_json_file_get_string_vec none~get->proc~wrap_json_file_get_string_vec proc~json_file_print_to_string json_file%json_file_print_to_string proc~json_file_print_to_string->proc~json_value_to_string proc~json_file_get_real32->none~get proc~json_file_get_real32_vec->none~get proc~wrap_json_file_get_alloc_string_vec->none~get proc~wrap_json_file_get_integer->none~get proc~wrap_json_file_get_integer_vec->none~get proc~wrap_json_file_get_logical->none~get proc~wrap_json_file_get_logical_vec->none~get proc~wrap_json_file_get_object->none~get proc~wrap_json_file_get_real->none~get proc~wrap_json_file_get_real32->none~get proc~wrap_json_file_get_real32_vec->none~get proc~wrap_json_file_get_real_vec->none~get proc~wrap_json_file_get_string->none~get proc~wrap_json_file_get_string_vec->none~get

Source Code

    pure function json_failed(json) result(failed)

    implicit none

    class(json_core),intent(in) :: json
    logical(LK)                 :: failed  !! will be true if an exception
                                           !! has been thrown.

    failed = json%exception_thrown

    end function json_failed