View source: R/utils_conditions.R
discord_cond | R Documentation |
Custom Conditions for the discord package
discord_cond(type, msg, class = paste0("discord-", type), call = NULL, ...)
type |
One of the following conditions: c("error", "warning", "message") |
msg |
Message |
class |
Default is to prefix the 'type' argument with "discord", but can be more specific to the problem at hand. |
call |
What triggered the condition? |
... |
Additional arguments that can be coerced to character or single condition object. |
A condition for discord.
## Not run:
derr <- function(x) discord_cond("error", x)
dwarn <- function(x) discord_cond("warning", x)
dmess <- function(x) discord_cond("message", x)
return_class <- function(func) {
tryCatch(func,
error = function(cond) class(cond),
warning = function(cond) class(cond),
message = function(cond) class(cond)
)
}
return_class(derr("error-class"))
return_class(dwarn("warning-class"))
return_class(dmess("message-class"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.