Skip to content

Commit

Permalink
mnt: Consider call. = FALSE
Browse files Browse the repository at this point in the history
  • Loading branch information
MEO265 committed Jul 15, 2024
1 parent 9fe3809 commit f8d0685
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/handlers.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ warning <- function(..., call. = TRUE, immediate. = FALSE, noBreaks. = FALSE,
# If the input is not a condition, the call of the warning must be set manually
# to avoid loggit2::warning being displayed as a call
is_condition <- (...length() == 1L && inherits(..1, "condition"))
call <- find_call()
call <- if (call.) find_call()

if (is_condition) {
tryCatch({
Expand All @@ -90,7 +90,7 @@ warning <- function(..., call. = TRUE, immediate. = FALSE, noBreaks. = FALSE,
})
} else {
tryCatch({
base::warning(..., call. = call., immediate. = immediate., noBreaks. = noBreaks., domain = domain)
base::warning(..., call. = FALSE, immediate. = immediate., noBreaks. = noBreaks., domain = domain)
}, warning = function(w) {
w <- simpleWarning(message = w[["message"]], call = call)
if (isTRUE(.loggit) || (!isFALSE(.loggit) && get_log_level() >= 2L)) {
Expand Down Expand Up @@ -127,7 +127,7 @@ stop <- function(..., call. = TRUE, domain = NULL, .loggit = NA, echo = get_echo
# If the input is not a condition, the call of the error must be set manually
# to avoid loggit2::stop being displayed as a call
is_condition <- (...length() == 1L && inherits(..1, "condition"))
call <- find_call()
call <- if (call.) find_call()

if (is_condition) {
tryCatch({
Expand All @@ -140,7 +140,7 @@ stop <- function(..., call. = TRUE, domain = NULL, .loggit = NA, echo = get_echo
})
} else {
tryCatch({
base::stop(..., call. = call., domain = domain)
base::stop(..., call. = FALSE, domain = domain)
}, error = function(e) {
e <- simpleError(message = e[["message"]], call = call)
if (isTRUE(.loggit) || (!isFALSE(.loggit) && get_log_level() >= 1L)) {
Expand Down

0 comments on commit f8d0685

Please sign in to comment.