This function is useful for testing or debugging the behavior of objective functions. It can throw a warning and / or an error on purpose.
Usage
test_objective(
x,
value = x,
warning_prob = 0,
error_prob = 0,
warning_msg = "warning",
error_msg = "error",
call. = TRUE
)