Because we aim to capture errors that are raised when evaluating packages, there is a fair bit of machinery to raise relevant errors when package assertions fail and capture errors during data execution.
Usage
.state
once_on_task_callback(name, expr, envir = parent.frame())
get_package_boundary_call(calls = sys.calls())
cnd_type(class = NULL, cnd = "error")
cnd_class_from_type(type, cnd = "error")
new_err(
...,
data = list(),
class = NULL,
call = NULL,
trace = NULL,
parent = NULL,
capture = FALSE,
.envir = parent.frame()
)
err
Functions
.state
: Global error raising flagsThis flag is used to determine when errors during execution should be captured or thrown to the evaluating environment. When data is being derived for the first time, we want to capture any errors, but when errors arrive during other uses of that data, we want to raise them to the user.
once_on_task_callback()
: Used to reset global state after a top level callback completesget_package_boundary_call()
: Walk the call stack to find the last call before the package boundary. This allows us to raise the most relevant parts of error messages back to users without exposing them to the internal non-standard evaluation calls.cnd_type()
: Create a condition typecnd_class_from_type()
: Extract a condition class from a typenew_err()
: Create a new errorThis function is a wrapper around
cli::cli_abort()
, but with defaults that make typical use within this package more interpretable to end-users.Used predominately by
err()
err
: Raise a new error, using one of a set of known error types
Fields
disallowed_permissions
Create an error indicating that a data derivation requires permissions that were not permitted at execution time.
missing_suggests
Create an error indicating that a dependency that is required for a specific data derivation is not available.
metric_not_atomic
Create an error indicating that a metric was derived but did not conform to its anticipated atomic return type.
derive_dependency
Create an error that is raised when a dependent data field threw an error during execution.
data_not_implemented
Create an error indicating that data could not be derived because it is not implemented for this resource.
derive_error
Wrap an error raised through data derivation in a packag error type for communication.