From ba56c7a3555ca78596553206ebf78fe1ff61d00d Mon Sep 17 00:00:00 2001 From: Jordan Mark Barbone Date: Fri, 6 Dec 2024 10:08:13 -0500 Subject: [PATCH] better error checking --- DESCRIPTION | 2 +- R/check-cran-status.R | 4 ++-- R/todos.R | 2 +- R/utils.R | 4 ++++ 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 95967bd..4096a85 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: Rprofile Title: Functions to be loaded with Rprofile -Version: 0.0.0.9008 +Version: 0.0.0.9009 Authors@R: person(given = "Jordan Mark", family = "Barbone", diff --git a/R/check-cran-status.R b/R/check-cran-status.R index 14586de..19a9275 100644 --- a/R/check-cran-status.R +++ b/R/check-cran-status.R @@ -12,7 +12,7 @@ if (is.null(email)) { email <- .try(get_description_emails()) - if (inherits(email, "rprofile_error")) { + if (is_rprofile_error(email)) { return(invisible()) } } @@ -27,7 +27,7 @@ cache = tempfile("dang_check_cran_status__", fileext = ".rds"), cache.life = 3600 )))) - if (!inherits(res, "error")) { + if (!is_rprofile_error(res)) { show_table() success <- TRUE } else { diff --git a/R/todos.R b/R/todos.R index 0479bb3..d8049f4 100644 --- a/R/todos.R +++ b/R/todos.R @@ -59,7 +59,7 @@ do_todos <- function( if ( !is.null(todo) && !.quiet && - !inherits(todo, "error") + !is_rprofile_error(todo) ) { print(todo) } diff --git a/R/utils.R b/R/utils.R index 9312f97..98ac18b 100644 --- a/R/utils.R +++ b/R/utils.R @@ -45,3 +45,7 @@ yes_no <- function(..., na = NULL) { NA } + +is_rprofile_error <- function(x) { + inherits(x, "rprofile_error") +}