Skip to contents

Follows the guidance from rlang::abort() on applying a call and a class in the error message. Used as a base in type-checkers to throw a properly formatted error.

Usage

throw_type_error(object, arg_name, expected_type, call = rlang::caller_env())

Arguments

object

Object with incorrect type

arg_name

Name of the argument corresponding to object

expected_type

The type that the user should provide instead

call

The calling environment to be reflected in the error message

Value

This function is called for its side effect of throwing an error. It should never return.