errored Subroutine

private subroutine errored(self, error, pref, group, switch)

Trig error occurrence and print meaningful message.

Type Bound

command_line_interface

Arguments

Type IntentOptional Attributes Name
class(command_line_interface), intent(inout) :: self

Object data.

integer(kind=I4P), intent(in) :: error

Error occurred.

character(len=*), intent(in), optional :: pref

Prefixing string.

character(len=*), intent(in), optional :: group

Group name.

character(len=*), intent(in), optional :: switch

CLA switch name.


Calls

proc~~errored~3~~CallsGraph proc~errored~3 flap_command_line_interface_t::command_line_interface%errored interface~colorize face::colorize proc~errored~3->interface~colorize proc~print_error_message flap_object_t::object%print_error_message proc~errored~3->proc~print_error_message proc~colorize_default face::colorize_default interface~colorize->proc~colorize_default proc~color_index face::color_index proc~colorize_default->proc~color_index proc~style_index face::style_index proc~colorize_default->proc~style_index proc~upper face::upper proc~colorize_default->proc~upper

Called by

proc~~errored~3~~CalledByGraph proc~errored~3 flap_command_line_interface_t::command_line_interface%errored proc~get_cla_list_varying_char~2 flap_command_line_interface_t::command_line_interface%get_cla_list_varying_char proc~get_cla_list_varying_char~2->proc~errored~3 proc~get_cla_list_varying_i1p~2 flap_command_line_interface_t::command_line_interface%get_cla_list_varying_I1P proc~get_cla_list_varying_i1p~2->proc~errored~3 proc~get_cla_list_varying_i2p~2 flap_command_line_interface_t::command_line_interface%get_cla_list_varying_I2P proc~get_cla_list_varying_i2p~2->proc~errored~3 proc~get_cla_list_varying_i4p~2 flap_command_line_interface_t::command_line_interface%get_cla_list_varying_I4P proc~get_cla_list_varying_i4p~2->proc~errored~3 proc~get_cla_list_varying_i8p~2 flap_command_line_interface_t::command_line_interface%get_cla_list_varying_I8P proc~get_cla_list_varying_i8p~2->proc~errored~3 proc~get_cla_list_varying_logical~2 flap_command_line_interface_t::command_line_interface%get_cla_list_varying_logical proc~get_cla_list_varying_logical~2->proc~errored~3 proc~get_cla_list_varying_r16p~2 flap_command_line_interface_t::command_line_interface%get_cla_list_varying_R16P proc~get_cla_list_varying_r16p~2->proc~errored~3 proc~get_cla_list_varying_r4p~2 flap_command_line_interface_t::command_line_interface%get_cla_list_varying_R4P proc~get_cla_list_varying_r4p~2->proc~errored~3 proc~get_cla_list_varying_r8p~2 flap_command_line_interface_t::command_line_interface%get_cla_list_varying_R8P proc~get_cla_list_varying_r8p~2->proc~errored~3 proc~get_cla_list~2 flap_command_line_interface_t::command_line_interface%get_cla_list proc~get_cla_list~2->proc~errored~3 proc~get_cla~2 flap_command_line_interface_t::command_line_interface%get_cla proc~get_cla~2->proc~errored~3 none~get_varying~2 flap_command_line_interface_t::command_line_interface%get_varying none~get_varying~2->proc~get_cla_list_varying_char~2 none~get_varying~2->proc~get_cla_list_varying_i1p~2 none~get_varying~2->proc~get_cla_list_varying_i2p~2 none~get_varying~2->proc~get_cla_list_varying_i4p~2 none~get_varying~2->proc~get_cla_list_varying_i8p~2 none~get_varying~2->proc~get_cla_list_varying_logical~2 none~get_varying~2->proc~get_cla_list_varying_r4p~2 none~get_varying~2->proc~get_cla_list_varying_r8p~2 none~get~2 flap_command_line_interface_t::command_line_interface%get none~get~2->proc~get_cla_list~2 none~get~2->proc~get_cla~2 proc~fake_call flap_test_group::fake_call proc~fake_call->none~get~2 program~flap_save_man_page flap_save_man_page program~flap_save_man_page->none~get~2 program~flap_save_usage_to_markdown flap_save_usage_to_markdown program~flap_save_usage_to_markdown->none~get~2 program~flap_test_action_store flap_test_action_store program~flap_test_action_store->none~get_varying~2 program~flap_test_action_store->none~get~2 program~flap_test_ansi_color_style flap_test_ansi_color_style program~flap_test_ansi_color_style->none~get~2 program~flap_test_basic flap_test_basic program~flap_test_basic->none~get_varying~2 program~flap_test_basic->none~get~2 program~flap_test_choices_logical flap_test_choices_logical program~flap_test_choices_logical->none~get~2 program~flap_test_duplicated_clas flap_test_duplicated_clas program~flap_test_duplicated_clas->none~get~2 program~flap_test_group_examples flap_test_group_examples program~flap_test_group_examples->none~get~2 program~flap_test_hidden flap_test_hidden program~flap_test_hidden->none~get~2 program~flap_test_ignore_unknown_clas flap_test_ignore_unknown_clas program~flap_test_ignore_unknown_clas->none~get~2 program~flap_test_minimal flap_test_minimal program~flap_test_minimal->none~get~2 program~flap_test_nargs_insufficient flap_test_nargs_insufficient program~flap_test_nargs_insufficient->none~get~2 program~flap_test_nargs_insufficient~2 flap_test_nargs_insufficient program~flap_test_nargs_insufficient~2->none~get~2 program~flap_test_nested flap_test_nested program~flap_test_nested->none~get~2 program~flap_test_string flap_test_string program~flap_test_string->none~get~2 program~flap_test_group flap_test_group program~flap_test_group->proc~fake_call

Source Code

  subroutine errored(self, error, pref, group, switch)
  !< Trig error occurrence and print meaningful message.
  class(command_line_interface), intent(inout) :: self   !< Object data.
  integer(I4P),                  intent(in)    :: error  !< Error occurred.
  character(*), optional,        intent(in)    :: pref   !< Prefixing string.
  character(*), optional,        intent(in)    :: group  !< Group name.
  character(*), optional,        intent(in)    :: switch !< CLA switch name.
  character(len=:), allocatable                :: prefd  !< Prefixing string.

  self%error = error
  if (self%error/=0) then
    prefd = '' ; if (present(pref)) prefd = pref
    prefd = prefd//self%progname//': '//colorize('error', color_fg=self%error_color, style=self%error_style)
    select case(self%error)
    case(ERROR_MISSING_CLA)
      self%error_message = prefd//': there is no option "'//trim(adjustl(switch))//'"!'
    case(ERROR_MISSING_SELECTION_CLA)
      self%error_message = prefd//': to get an option value one of switch "name" or "position" must be provided!'
    case(ERROR_MISSING_GROUP)
      self%error_message = prefd//': ther is no group (command) named "'//trim(adjustl(group))//'"!'
    case(ERROR_TOO_FEW_CLAS)
      ! self%error_message = prefd//': too few arguments ('//trim(str(.true.,Na))//')'//&
                         ! ' respect the required ('//trim(str(.true.,self%Na_required))//')'
    endselect
    write(self%error_lun,'(A)')
    call self%print_error_message
  endif
  endsubroutine errored