fatal_error: Signal a fatal error (and optionally terminate the program...

View source: R/errors.R

fatal_errorR Documentation

Signal a fatal error (and optionally terminate the program execution)

Description

fatal_error() is equivalent to the base function base::stop(), except it is intended to signal critical errors where recovery is impossible or unfeasible.

Fatal errors are signaled via rlang::abort() with the class precondition/fatal_error. The option fatal_error_action controls the behavior of the fatal errors.

  • option(fatal_error_action = "inform") will display a warning if a fatal error has been prevented from bubbling up to the # user(either via 'tryCatch() or some other error handling mechanism). This is the default setting and will draw user's attention to a fatal error occurring.

  • option(fatal_error_action = "none") will make fatal errors behave like regular R error conditions. Use this if your code contains custom logic for handling fatal errors.

  • option(fatal_error_action = 'terminate') will immediately the program execution without saving the workspace or running finalizers when a fatal error occurs.

Usage

fatal_error(bullets, ...)

Arguments

bullets

a character vector containing the error message, can be formatted in the style of rlang::format_error_bullets()

...

reserved for future use

Details

fatal_error() is used in sanity_check() to report critical assertion failures.


precondition documentation built on March 31, 2023, 10:20 p.m.