diff --git a/R/check.R b/R/check.R index 2b5b74791..810c21601 100644 --- a/R/check.R +++ b/R/check.R @@ -38,10 +38,6 @@ #' all(unlist(s2)) sanity <- function(object, big_sd_log10 = 2, gradient_thresh = 0.001, silent = FALSE) { - if ( isFALSE(object$call$do_fit)) { - cli_abort("`do_fit = FALSE` so this model hasn't been fit yet") - } - # make it easy to use output from try() if (length(object) <= 1L) { if (is.na(object) || is.null(object)) { @@ -52,6 +48,9 @@ sanity <- function(object, big_sd_log10 = 2, gradient_thresh = 0.001, silent = F return(FALSE) } assert_that(inherits(object, "sdmTMB")) + if ( isFALSE(object$call$do_fit)) { + cli_abort("`do_fit = FALSE` so this model hasn't been fit yet") + } hessian_ok <- eigen_values_ok <- gradients_ok <- se_magnitude_ok <- FALSE nlminb_ok <- FALSE