Skip to content

Commit bae1fe1

Browse files
authored
Clarify parent argument usage in condition handlers (#1869)
Updated documentation for condition handling to clarify usage of the parent argument.
1 parent 99760f0 commit bae1fe1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

R/cnd-handlers.R

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,21 @@ environment(hnd_prompt_install) <- baseenv()
9797
#' ```
9898
#'
9999
#' - **Rethrow conditions**, e.g. using `abort(msg, parent = cnd)`.
100-
#' See the `parent` argument of [abort()]. This is typically done to
100+
#' The `parent` argument of [abort()], [warn()], and [inform()]
101+
#' can be used to chain conditions. This is typically done to
101102
#' add information to low-level errors about the high-level context
102103
#' in which they occurred.
103104
#'
104105
#' ```
105106
#' try_fetch(1 + "", error = function(cnd) abort("Failed.", parent = cnd))
107+
#'
108+
#' try_fetch(
109+
#' 1 + "",
110+
#' error = function(cnd) {
111+
#' warn("Failed. Returning 1", parent = cnd)
112+
#' 1L
113+
#' }
114+
#' )
106115
#' ```
107116
#'
108117
#' - **Inspect conditions**, for instance to log data about warnings

0 commit comments

Comments
 (0)