| abort | R Documentation |
Signals a condition AND optionally writes a styled event line to the operator console. The two channels carry complementary information so nothing is duplicated:
abort(
...,
class = NULL,
data = NULL,
parent = NULL,
verbosity = NULL,
package = NULL
)
... |
Message components, concatenated with no separator. |
class |
Character vector: Additional condition classes (prepended
to the base |
data |
Named list or NULL: Structured fields attached to the
signalled condition, retrievable by handlers via |
parent |
Condition or NULL: Wrapped parent condition. Its message is
echoed to the console (when verbosity allows) and stored on the
signalled condition as |
verbosity |
Integer or NULL: Overrides |
package |
Character or NULL: Package name for verbosity override. |
Console echo (when verbosity allows): the most-specific condition
class plus the caller bracket - a structured "what failed, where"
line. Falls back to "rtemis_error" when class = NULL so the line
is always namespace-tagged and recognizable as ours.
Condition $message: the corrective human-readable text passed
via .... Plain text with all ANSI escapes stripped, so it is safe
to serialize into JSON, HTML, or any other ANSI-unaware sink (e.g.
browser-side error display), and is what conditionMessage() /
R's default error printer / tryCatch(error = ...) handlers see.
Use class to add wire-protocol-specific condition classes that callers
can catch via tryCatch(). The base classes "rtemis_error", "error",
and "condition" are always added.
The condition also carries $calls - a pairlist of sys.calls()
captured at the abort site, with abort()'s own frame trimmed. Unlike
base R's traceback() (which only sees .Traceback, populated only
when an error reaches the top-level uncaught), $calls survives
tryCatch() and travels with the condition - so server-side handlers
can ship the stack to a browser-side debug pane, or callers can call
format_trace() to print it.
The field is deliberately not named trace: rlang and testthat treat
that name as an rlang::trace_back() object and call nrow() on it, so
a pairlist there makes testthat's reporter fail while formatting the
error. Leaving the name unclaimed also lets testthat show its own
backtrace, which is pruned to user frames where this one is not. For the
same reason abort() rejects data$trace, so a caller cannot put the
crash back by another route.
Does not return - always signals a condition via stop().
EDG
## Not run:
abort("Could not parse ", "hyperparameters", ".",
class = "rtemislive_invalid_params")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.