Get complete error message with cause chain and stack trace Returns a dynamically-sized multi-line string
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(error_t), | intent(in) | :: | self |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer(kind=default_int), | private | :: | i | ||||
| character(len=32), | private | :: | idx_str |
function error_get_full_trace(self) result(trace) !! Get complete error message with cause chain and stack trace !! Returns a dynamically-sized multi-line string class(error_t), intent(in) :: self character(len=:), allocatable :: trace character(len=32) :: idx_str integer(default_int) :: i if (.not. self%has_error()) then trace = "" return end if ! Top-level error with named code trace = code_to_string(self%code)//": " if (allocated(self%message)) then trace = trace//self%message end if ! Cause chain: prints from most-recent wrap (cause_depth) down to ! root cause (1), matching Rust's "caused by" display order do i = self%cause_depth, 1, -1 trace = trace//new_line('a')//" Caused by: "// & trim(code_to_string(self%cause_codes(i)))//": "// & trim(self%cause_messages(i)) end do ! Stack trace if (self%stack_depth > 0) then trace = trace//new_line('a')//"Call stack (most recent first):" do i = self%stack_depth, 1, -1 write (idx_str, '(I0)') i trace = trace//new_line('a')//" ["//trim(idx_str)//"] "// & trim(self%call_stack(i)) end do end if end function error_get_full_trace