# ~~~~~~~~~~~~~~~ Exports ~~~~~~~~~~~~~~~~ #
# ~~~~~~~~~~~~~~~ Internal ~~~~~~~~~~~~~~~ #
pretty_stopifnot <- function(message, reason, condition) {
if (isFALSE(condition)) {
rlang::abort(
c(
message,
x = reason
),
call = NULL,
class = construct_error("stopifnot")
)
}
}
construct_error <- function(x) {
last_error <<- rlang::trace_back()
sprintf("emitters-%s-error", x)
}
error_method_not_implemented <- function(missing_method_name) {
error <- construct_error("missing_method")
rlang::abort(
c(
sprintf(" User must define method for '%s'", missing_method_name),
x = "No transform method was defined when instantiating a <TransformStream>"
),
class = error
)
}
error_unhandled_error_event <- function(err) {
error <- construct_error("unhandled_error_event")
rlang::abort(
c(
"Error occured without an attached error handler",
i = "Error events require error listeners to appropriately handle their errors",
x = err
),
class = error
)
}
error_callback_evaluation <- function(phase, err) {
error <- construct_error("callback_evaluation")
rlang::abort(
c(
i = sprintf("During the %s event phase, an error occured while executing from the callback stack with the following error:", phase),
x = err
),
class = error
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.