EVOLUTION-MANAGER
Edit File: cli_abort.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Signal an error, warning or message with a cli formatted...</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for cli_abort {cli}"><tr><td>cli_abort {cli}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Signal an error, warning or message with a cli formatted message</h2> <h3>Description</h3> <p>These functions let you create error, warning or diagnostic messages with cli formatting, including inline styling, pluralization and glue substitutions. </p> <h3>Usage</h3> <pre> cli_abort( message, ..., call = .envir, .envir = parent.frame(), .frame = .envir ) cli_warn(message, ..., .envir = parent.frame()) cli_inform(message, ..., .envir = parent.frame()) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>message</code></td> <td> <p>It is formatted via a call to <code><a href="cli_bullets.html">cli_bullets()</a></code>.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Passed to <code><a href="../../rlang/html/abort.html">rlang::abort()</a></code>, <code><a href="../../rlang/html/abort.html">rlang::warn()</a></code> or <code><a href="../../rlang/html/abort.html">rlang::inform()</a></code>.</p> </td></tr> <tr valign="top"><td><code>call</code></td> <td> <p>The execution environment of a currently running function, e.g. <code>call = caller_env()</code>. The corresponding function call is retrieved and mentioned in error messages as the source of the error. </p> <p>You only need to supply <code>call</code> when throwing a condition from a helper function which wouldn't be relevant to mention in the message. </p> <p>Can also be <code>NULL</code> or a <a href="../../rlang/html/topic-defuse.html">defused function call</a> to respectively not display any call or hard-code a code to display. </p> <p>For more information about error calls, see <a href="../../rlang/html/topic-error-call.html">Including function calls in error messages</a>.</p> </td></tr> <tr valign="top"><td><code>.envir</code></td> <td> <p>Environment to evaluate the glue expressions in.</p> </td></tr> <tr valign="top"><td><code>.frame</code></td> <td> <p>The throwing context. Used as default for <code>.trace_bottom</code>, and to determine the internal package to mention in internal errors when <code>.internal</code> is <code>TRUE</code>.</p> </td></tr> </table> <h3>Details</h3> <div class="sourceCode r"><pre>n <- "boo" cli_abort(c( "{.var n} must be a numeric vector", "x" = "You've supplied a {.cls {class(n)}} vector." )) </pre></div> <div class="asciicast" style="color: #172431;font-family: 'Fira Code',Monaco,Consolas,Menlo,'Bitstream Vera Sans Mono','Powerline Symbols',monospace;line-height: 1.300000"><pre> #> <span style="font-weight: bold;color: #B58900;">Error</span><span style="font-weight: bold;">:</span> #> <span style="color: #B58900;">!</span> `n` must be a numeric vector #> <span style="color: #DC322F;">✖</span> You've supplied a <span style="color: #268BD2;"><character></span> vector. #> <span style="color: #002B36;">Run `rlang::last_error()` to see where the error occurred.</span> </pre></div> <div class="sourceCode r"><pre>len <- 26 idx <- 100 cli_abort(c( "Must index an existing element:", "i" = "There {?is/are} {len} element{?s}.", "x" = "You've tried to subset element {idx}." )) </pre></div> <div class="asciicast" style="color: #172431;font-family: 'Fira Code',Monaco,Consolas,Menlo,'Bitstream Vera Sans Mono','Powerline Symbols',monospace;line-height: 1.300000"><pre> #> <span style="font-weight: bold;color: #B58900;">Error</span><span style="font-weight: bold;">:</span> #> <span style="color: #B58900;">!</span> Must index an existing element: #> <span style="color: #2AA198;">ℹ</span> There are 26 elements. #> <span style="color: #DC322F;">✖</span> You've tried to subset element 100. #> <span style="color: #002B36;">Run `rlang::last_error()` to see where the error occurred.</span> </pre></div> <hr /><div style="text-align: center;">[Package <em>cli</em> version 3.4.1 <a href="00Index.html">Index</a>]</div> </body></html>