Create an error that will stop immediately, or can be continued from.

deferrable_error(message)

Arguments

message

The error message

Examples

# Deferrable errors will throw immediately if no suitable calling # handlers are established: tryCatch( deferrable_error("my error"), error = identity)
#> <deferrable_error in doTryCatch(return(expr), name, parentenv, handler): my error>
# Create a deferrable error and continue from it, using # withCallingHandlers: value <- withCallingHandlers({ x <- 1 defer::deferrable_error("a deferrable error") x * 2 }, deferrable_error = function(e) invokeRestart("continue_deferrable_error"))