code_to_string Function

public pure function code_to_string(code) result(name)

Map an error code to a human-readable name

Usage: print *, code_to_string(ERROR_IO) ! “ERROR_IO”

Arguments

Type IntentOptional Attributes Name
integer(kind=default_int), intent(in) :: code

Return Value character(len=:), allocatable


Called by

proc~~code_to_string~~CalledByGraph proc~code_to_string code_to_string proc~error_get_full_trace error_t%error_get_full_trace proc~error_get_full_trace->proc~code_to_string proc~error_print_trace error_t%error_print_trace proc~error_print_trace->proc~code_to_string proc~error_fatal error_t%error_fatal proc~error_fatal->proc~error_print_trace

Source Code

   pure function code_to_string(code) result(name)
      !! Map an error code to a human-readable name
      !!
      !! Usage: print *, code_to_string(ERROR_IO)  ! "ERROR_IO"
      integer(default_int), intent(in) :: code
      character(len=:), allocatable :: name

      select case (code)
      case (SUCCESS)
         name = "SUCCESS"
      case (ERROR_GENERIC)
         name = "ERROR_GENERIC"
      case (ERROR_IO)
         name = "ERROR_IO"
      case (ERROR_PARSE)
         name = "ERROR_PARSE"
      case (ERROR_VALIDATION)
         name = "ERROR_VALIDATION"
      case (ERROR_ALLOC)
         name = "ERROR_ALLOC"
      case default
         name = "UNKNOWN"
      end select
   end function code_to_string