Trig error occurrence and print meaningful message.
Type | Intent | Optional | 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. |
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