Skip to content

Commit

Permalink
Fixed #235
Browse files Browse the repository at this point in the history
  • Loading branch information
thekangaroofactory committed Feb 16, 2024
1 parent 15415dc commit bf84ea6
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion R/dm_get_default.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,20 @@ dm_get_default <- function(data.model, name){

# -- P1: default function
if(!is.na(default_fun)){
value <- eval(do.call(ktools::getNsFunction(default_fun), args = list()))

# -- wrapping next line into a tryCatch #235
#value <- eval(do.call(ktools::getNsFunction(default_fun), args = list()))
value <- tryCatch(eval(do.call(ktools::getNsFunction(default_fun), args = list())),

error = function(e) {

# -- print error
cat("[WARNING] There was an error when trying to apply the default function =", default_fun, "\n")
print(e)

# -- return NA (default)
NA})

cat("- strategy: applying default function, output =", value, "\n")}

# -- P2: then default value
Expand Down

0 comments on commit bf84ea6

Please sign in to comment.