Skip to content

printing caught errors without cli installed does not work #1815

@TimTaylor

Description

@TimTaylor

Printing caught conditions doesn't seem work if cli is not installed

library(rlang)
cnd <- tryCatch(abort("bob"), error = identity)
str(cnd)
# List of 5
# $ message: chr "bob"
# $ trace  :Classes 'rlang_trace', 'rlib_trace', 'tbl' and 'data.frame':	5 obs. of  6 variables:
#  ..$ call       :List of 5
#  .. ..$ : language tryCatch(abort("bob"), error = identity)
#  .. ..$ : language tryCatchList(expr, classes, parentenv, handlers)
#  .. ..$ : language tryCatchOne(expr, names, parentenv, handlers[[1L]])
#  .. ..$ : language doTryCatch(return(expr), name, parentenv, handler)
#  .. ..$ : language abort("bob")
#  ..$ parent     : int [1:5] 0 1 2 3 0
#  ..$ visible    : logi [1:5] TRUE TRUE TRUE TRUE TRUE
#  ..$ namespace  : chr [1:5] "base" "base" "base" "base" ...
#  ..$ scope      : chr [1:5] "::" "local" "local" "local" ...
#  ..$ error_frame: logi [1:5] FALSE FALSE FALSE FALSE FALSE
#  ..- attr(*, "version")= int 2
# $ parent : NULL
# $ rlang  :List of 1
#  ..$ inherit: logi TRUE
# $ call   : NULL
# - attr(*, "class")= chr [1:3] "rlang_error" "error" "condition"
cnd
# Error in loadNamespace(x) : there is no package called 'cli'

nor does try_fetch

cnd <- try_fetch(abort("bob"), error = identity)
cnd
# Error in loadNamespace(x) : there is no package called 'cli'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions