From 36ffa4dab1dacf6bcbf31ee47cbff8a0889d0d5b Mon Sep 17 00:00:00 2001 From: Aki Vehtari Date: Wed, 20 Mar 2024 09:33:46 +0200 Subject: [PATCH] Apply suggestions from code review by jgabry Co-authored-by: Jonah Gabry --- R/loo_moment_matching.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/loo_moment_matching.R b/R/loo_moment_matching.R index bcfcc296..b8832e7e 100644 --- a/R/loo_moment_matching.R +++ b/R/loo_moment_matching.R @@ -286,7 +286,7 @@ loo_moment_match_i <- function(i, # 1. match means trans <- shift(x, uparsi, lwi) # gather updated quantities - quantities_i <- tryCatch(update_quantities_i(x, trans$upars, i = i, + quantities_i <- try(update_quantities_i(x, trans$upars, i = i, orig_log_prob = orig_log_prob, log_prob_upars = log_prob_upars, log_lik_i_upars = log_lik_i_upars, @@ -295,7 +295,7 @@ loo_moment_match_i <- function(i, is_method = is_method, ...) ) - if (is_try_error(quantities_i)) { + if (inherits(quantities_i, "try-error")) { # Stan log prob caused an exception probably due to under- or # overflow of parameters to invalid values break @@ -325,7 +325,7 @@ loo_moment_match_i <- function(i, is_method = is_method, ...) ) - if (is_try_error(quantities_i)) { + if (inherits(quantities_i, "try-error")) { # Stan log prob caused an exception probably due to under- or # overflow of parameters to invalid values break @@ -358,7 +358,7 @@ loo_moment_match_i <- function(i, ...) ) - if (is_try_error(quantities_i)) { + if (inherits(quantities_i, "try-error")) { # Stan log prob caused an exception probably due to under- or # overflow of parameters to invalid values break