Add a call location to the stack trace Typically called when propagating errors upward
Example: call some_routine(…, err) if (err%has_error()) then call err%add_context(“pic_module:my_subroutine”) return end if
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(error_t), | intent(inout) | :: | self | |||
| character(len=*), | intent(in) | :: | location |
pure subroutine error_add_context(self, location) !! Add a call location to the stack trace !! Typically called when propagating errors upward !! !! Example: !! call some_routine(..., err) !! if (err%has_error()) then !! call err%add_context("pic_module:my_subroutine") !! return !! end if class(error_t), intent(inout) :: self character(len=*), intent(in) :: location if (self%stack_depth < MAX_STACK_DEPTH) then self%stack_depth = self%stack_depth + 1 self%call_stack(self%stack_depth) = location end if end subroutine error_add_context