R/conditions.R

Defines functions not_implemented_error runtime_error value_error type_error

type_error <- function(msg, env = rlang::caller_env()) {
  rlang::abort(glue::glue(gettext(msg), .envir = env), class = "type_error")
}

value_error <- function(..., env = rlang::caller_env()) {
  rlang::abort(glue::glue(gettext(..., domain = "R-torchvision"), .envir = env), class = "value_error")
}

runtime_error <- function(msg, env = rlang::caller_env()) {
  rlang::abort(glue::glue(gettext(msg), .envir = env), class = "runtime_error")
}

not_implemented_error <- function(msg, env = rlang::caller_env()) {
  rlang::abort(glue::glue(gettext(msg), .envir = env), class = "not_implemented_error")
}
mlverse/torchvision documentation built on Sept. 18, 2024, 4:03 p.m.