| rtemis_conditions | R Documentation |
Errors signalled by rtemis are classed R conditions, so they can be
handled selectively with tryCatch() or withCallingHandlers() by class. Each error carries a class vector ordered from the
most specific failure mode to the most general, so a handler can catch
narrowly (e.g. only type errors) or broadly (e.g. any invalid input).
Every rtemis error inherits, in order: its specific class (when applicable),
its category class, and finally "rtemis_error", "error", "condition".
Catching rtemis_error therefore catches all rtemis errors.
Not applicable. This page documents the condition classes; the functions that signal them do not return when they error.
rtemis_input_errorA function argument supplied by the caller is invalid. Specific classes:
rtemis_type_errorArgument is of the wrong type or class.
rtemis_value_errorArgument has a disallowed value or choice.
rtemis_length_errorArgument has the wrong length or count.
rtemis_range_errorArgument is outside its allowed range.
rtemis_null_inputA required argument is NULL or empty.
rtemis_data_errorThe supplied dataset is unsuitable for the requested operation. Specific classes:
rtemis_dim_errorData has the wrong dimensions (e.g. too few columns).
rtemis_level_mismatchFactor levels do not match across data splits.
rtemis_missing_dataData contains missing values where none are allowed.
rtemis_outcome_errorThe outcome column has an invalid or mismatched type.
rtemis_io_errorA filesystem operation failed. Specific classes:
rtemis_file_not_foundA path or file does not exist.
rtemis_file_existsA file already exists and overwriting was not permitted.
rtemis_unsupported_errorThe requested algorithm, feature, or combination is not supported (e.g. multiclass classification for an algorithm that only handles binary outcomes). No specific subclass.
rtemis_runtime_errorA model or algorithm call failed during execution. The original error is
attached as the condition's $parent. No specific subclass.
EDG
rtemis-package
# Every rtemis error inherits `rtemis_error`. Catch a category broadly:
result <- tryCatch(
set_outcome(iris, "nonexistent_column"),
rtemis_input_error = function(e) {
message("Caught an input error: ", conditionMessage(e))
NULL
}
)
# Or catch a specific failure mode only:
result <- tryCatch(
set_outcome(iris, "nonexistent_column"),
rtemis_value_error = function(e) {
message("Caught a value error: ", conditionMessage(e))
NULL
}
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.