error_get_full_trace Function

private function error_get_full_trace(this) result(trace)

Get complete error message with stack trace Returns a multi-line string with error and call stack

Type Bound

error_t

Arguments

Type IntentOptional Attributes Name
class(error_t), intent(in) :: this

Return Value character(len=:), allocatable


Calls

proc~~error_get_full_trace~~CallsGraph proc~error_get_full_trace error_t%error_get_full_trace proc~error_has_error error_t%error_has_error proc~error_get_full_trace->proc~error_has_error

Called by

proc~~error_get_full_trace~~CalledByGraph proc~error_get_full_trace error_t%error_get_full_trace proc~compute_gmbe compute_gmbe proc~compute_gmbe->proc~error_get_full_trace proc~process_intersection_derivatives process_intersection_derivatives proc~compute_gmbe->proc~process_intersection_derivatives proc~map_fragment_to_system_gradient map_fragment_to_system_gradient proc~map_fragment_to_system_gradient->proc~error_get_full_trace proc~node_worker node_worker proc~node_worker->proc~error_get_full_trace proc~process_intersection_derivatives->proc~error_get_full_trace proc~run_multi_molecule_calculations run_multi_molecule_calculations proc~run_multi_molecule_calculations->proc~error_get_full_trace proc~run_calculation run_calculation proc~run_multi_molecule_calculations->proc~run_calculation proc~serial_fragment_processor serial_fragment_processor proc~serial_fragment_processor->proc~error_get_full_trace proc~compute_mbe compute_mbe proc~serial_fragment_processor->proc~compute_mbe proc~serial_gmbe_pie_processor serial_gmbe_pie_processor proc~serial_gmbe_pie_processor->proc~error_get_full_trace proc~unfragmented_calculation unfragmented_calculation proc~unfragmented_calculation->proc~error_get_full_trace interface~node_worker node_worker interface~node_worker->proc~node_worker interface~serial_fragment_processor serial_fragment_processor interface~serial_fragment_processor->proc~serial_fragment_processor interface~unfragmented_calculation unfragmented_calculation interface~unfragmented_calculation->proc~unfragmented_calculation proc~compute_mbe->proc~map_fragment_to_system_gradient proc~compute_mbe_gradient compute_mbe_gradient proc~compute_mbe->proc~compute_mbe_gradient proc~compute_mbe_gradient->proc~map_fragment_to_system_gradient proc~gmbe_run_serial gmbe_context_t%gmbe_run_serial proc~gmbe_run_serial->proc~serial_gmbe_pie_processor program~main main program~main->proc~run_multi_molecule_calculations program~main->proc~run_calculation proc~global_coordinator global_coordinator proc~global_coordinator->proc~compute_mbe proc~gmbe_run_distributed gmbe_context_t%gmbe_run_distributed proc~gmbe_run_distributed->interface~node_worker proc~mbe_run_distributed mbe_context_t%mbe_run_distributed proc~mbe_run_distributed->interface~node_worker interface~global_coordinator global_coordinator proc~mbe_run_distributed->interface~global_coordinator proc~mbe_run_serial mbe_context_t%mbe_run_serial proc~mbe_run_serial->interface~serial_fragment_processor proc~run_unfragmented_calculation run_unfragmented_calculation proc~run_unfragmented_calculation->interface~unfragmented_calculation interface~global_coordinator->proc~global_coordinator proc~run_calculation->proc~run_unfragmented_calculation proc~compute_energy_and_forces compute_energy_and_forces proc~compute_energy_and_forces->proc~run_calculation

Variables

Type Visibility Attributes Name Initial
character(len=2048), private :: buffer
integer, private :: i
integer, private :: pos

Source Code

   function error_get_full_trace(this) result(trace)
      !! Get complete error message with stack trace
      !! Returns a multi-line string with error and call stack
      class(error_t), intent(in) :: this
      character(len=:), allocatable :: trace
      character(len=2048) :: buffer
      integer :: i, pos

      if (.not. this%has_error()) then
         trace = ""
         return
      end if

      ! Build error message
      write (buffer, '(A,I0,A)') "Error ", this%code, ": "
      pos = len_trim(buffer) + 1

      if (allocated(this%message)) then
         buffer(pos:) = this%message
         pos = len_trim(buffer) + 1
      end if

      ! Add stack trace if available
      if (this%stack_depth > 0) then
         buffer(pos:) = new_line('a')//"Call stack (most recent first):"
         pos = len_trim(buffer) + 1

         do i = this%stack_depth, 1, -1
            write (buffer(pos:), '(A,I0,A)') new_line('a')//"  [", i, "] "
            pos = len_trim(buffer) + 1
            buffer(pos:) = trim(this%call_stack(i))
            pos = len_trim(buffer) + 1
         end do
      end if

      trace = trim(buffer)
   end function error_get_full_trace