R/print_error.R

Defines functions print_error

Documented in print_error

#' @title print_error
#' @description
#' Handle and print out error for invalid API call.
#' @param output key-value mapping of the output
#' @return None
#' @examples
#' \dontrun{print_error(list(message = "test"))}
#' @import jsonlite
#' @import stringr
#' @import httr
#' @import tidyverse
#' @import stats
#' @import utils
#' @export
print_error <- function(output) {
  tryCatch(
    {
      message(paste0("ERROR: ", output$message))
    },
    error = function() {
      message(paste0("ERROR: ", output$errorMessage))
    }
  )
  return()
}

Try the regcensus package in your browser

Any scripts or data that you put into this service are public.

regcensus documentation built on Oct. 4, 2023, 1:07 a.m.