r-lib / rlang

Low-level API for programming with R
https://rlang.r-lib.org
Other
500 stars 137 forks source link

Turning off condition inheritance #1578

Closed lionel- closed 1 year ago

lionel- commented 1 year ago

Follow up to #1573 (see discussion there).

New .inherit = <bool> argument. This controls whether cnd_inherits() and try_fetch() are allowed to match parent conditions. The default is TRUE in abort(). In warn() and inform(), the default is TRUE in the general case, and FALSE when parent is a condition of higher severity. This prevents matching downgraded conditions unexpectedly.

The parameter is stored in cnd$rlang$inherit. This is a public field (otherwise it'd be stored in rlang$internal$. It's namespaced to avoid name clashes with subclasses.

cc @DavisVaughan @gaborcsardi