Skip to content

Commit

Permalink
backport tryInvokeRestart()
Browse files Browse the repository at this point in the history
  • Loading branch information
nbenn committed Dec 21, 2023
1 parent a20e4fe commit 2373404
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion R/dbFetch_AdbiResult.R
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,31 @@ converter_to <- function(to) {

conversion_warn_handler <- function(to) {

if (getRversion() >= "4.0.0") {

restart_fun <- tryInvokeRestart

} else {

restart_fun <- function(r, ...) {

if (!isRestart(r)) {
r <- findRestart(r)
}

if (is.null(r)) {
invisible(NULL)
} else {
invokeRestart(r, ...)
}
}
}

handler <- switch(
bigint_mode(to),
classic = function(class) {
class <- force(class)
function(w) if (inherits(w, class)) tryInvokeRestart("muffleWarning")
function(w) if (inherits(w, class)) restart_fun("muffleWarning")
},
strict = function(class) {
class <- force(class)
Expand Down

0 comments on commit 2373404

Please sign in to comment.