Skip to content

Commit

Permalink
Show how to use call = base::call() in abort() (#1704)
Browse files Browse the repository at this point in the history
* Show how to use call = `base::call()`

* Tweak wording and fix missing `message` argument

---------

Co-authored-by: Lionel Henry <[email protected]>
  • Loading branch information
olivroy and lionel- authored May 31, 2024
1 parent 5338bff commit d7be54d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions R/cnd-abort.R
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,17 @@
#' })
#' )
#'
#' # You can also hard-code the call when it's not easy to
#' # forward it from the caller
#' f <- function() {
#' abort("my message", call = call("my_function"))
#' }
#' g <- function() {
#' f()
#' }
#' # Shows that the error occured in `my_function()`
#' try(g())
#'
#' }
#' @export
abort <- function(message = NULL,
Expand Down
11 changes: 11 additions & 0 deletions man/abort.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d7be54d

Please sign in to comment.