R/parse.R

Defines functions get_call.character get_call.condition get_call get_msg.condition get_msg.character get_msg

#' Extract Message
#' 
#' Extract message from error and warnings.
#' 
#' @param obj Message string, object of class `error`,
#' or `warning`.
#'
#' @noRd 
#' @keywords internal
get_msg <- function(obj) UseMethod("get_msg")

get_msg.character <- function(obj){
  return(obj)
}

get_msg.condition <- function(obj){
  return(obj$message)
}


#' Extract Call
#' 
#' Extract call from error and warnings.
#' 
#' @param obj Message string, object of class `error`,
#' or `warning`.
#'
#' @noRd 
#' @keywords internal
get_call <- function(obj) UseMethod("get_call")

get_call.condition <- function(obj){
  if(is.null(obj$call))
    return(NA_character_)

  obj$call
}

get_call.character <- function(obj){
  NA_character_
}

Try the erratum package in your browser

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

erratum documentation built on Jan. 4, 2022, 1:08 a.m.