[
https://issues.apache.org/jira/browse/ARROW-15359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17477942#comment-17477942
]
Dewey Dunnington commented on ARROW-15359:
------------------------------------------
Thanks for bringing this up! I've found that using {{rlang::abort()}} with
{{glue::glue()}} has made the error messages in the R package I maintain much
better since it makes it easy to provide useful output. As you've pointed out,
rlang is already a namespace dependency and so is glue (through vctrs). In
addition to your proposed update, I think we should add that {{abort(glue()}}
(without the {{rlang::}} or {{glue::}} should be the preferred way to signal an
error if additional information is required (as opposed to {{paste()}},
{{paste0()}}, or {{sprintf()}}).
A note that this is how errors are signalled everywhere in the tidyverse where
those dependencies are allowed (e.g., dplyr, ggplot2).
> [R] Discussion: should we use {rlang} for condition handling?
> -------------------------------------------------------------
>
> Key: ARROW-15359
> URL: https://issues.apache.org/jira/browse/ARROW-15359
> Project: Apache Arrow
> Issue Type: Improvement
> Components: R
> Reporter: Dragoș Moldovan-Grünfeld
> Priority: Major
>
> Currently we have a mixture of {{base::stop()}} and {{rlang::abort()}} in the
> codebase. Should we make a deliberate choice to use one or the other?
> If we decided to switch to {{{}rlang{}}}, we could:
> * change the codebase as we go along, switching from {{base}} functions
> ({{{}stop(), warning(), message(){}}} to their {{rlang}} equivalents
> {{abort(), warn(), inform()}}
> * make an addendum to {{STYLE.md}} on condition handling
> We could cover additional aspects of condition handling such as the wording
> of messages - for example, by using key words such as *must* or {*}should{*}.
> Please discuss direction and why. :)
> Note: the {{arrow}} R package already depends on {{rlang}} so any outcome
> will not result in additional dependencies.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)