-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Augment Abort
& co.; add rlang
condition tutorial, helpers
#102
base: dev
Are you sure you want to change the base?
Conversation
- Add `Inform`, similar to `Abort` and `Warn` - Add `class_suffix`, `display_subfields`, `more_subfields`, and `call` to `Abort`, `Warn`, `Inform` - On first raised condition, provide a tutorial on `rlang` conditions to help users with compatibility issues and potentially-unknown features - Improve condition traces via `call` default - Improve condition message line wrapping, compatibility with messages with bullet points, etc.
# inside this template tag file, leading to long `r ...` chunks; don't | ||
# wrap/fill/format these, or else current roxygen2 at time of writing will not | ||
# properly process them. Keep the blank lines around them to help prevent | ||
# accidental auto-formatting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Roxygen templates provide a different way to execute dynamic code with <%= ...... %>. Might provide a way around the line wrap fighting. (Here and in other template file, and maybe also in other non-template places where dynamic R code is used that could be turned into templates.)
#' | ||
#' @importFrom rlang caller_env is_reference global_env base_env empty_env | ||
#' is_function | ||
#' @importFrom tibble lst |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might need @noRd
here and in other internal helper functions. Not the handler ones though, as they will be referenced by the tutorial.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vs. @keywords internal
?
|
|
This is a draft. The additional
Abort
&co. features still need to havetestthat tests
, and to be used throughout the package.Motivation: we "use"
rlang
conditions, butoptions(error=recover)
debugging workflow in at least some R versionsrlang
conditions from just following the prompts torlang::last_error()
andrlang::last_trace()
We want to help users get accustomed to
rlang
conditions, and take advantage of more of its features; building onAbort
andWarn
seems like a good way.Changes so far:
Inform
, similar toAbort
andWarn
class_suffix
,display_subfields
,more_subfields
, andcall
toAbort
,Warn
,Inform
rlang
conditions to helpusers with compatibility issues and potentially-unknown features
call
defaultbullet points, etc.
To complement the tutorial, some convenience functions for working with global calling handlers, as well as some handler functions, are provided.