Learn R Programming

plumber (version 1.2.2)

pr_set_debug: Set debug value to include error messages of routes cause an error

Description

To hide any error messages in production, set the debug value to FALSE. The debug value is enabled by default for interactive() sessions.

Usage

pr_set_debug(pr, debug = interactive())

Value

The Plumber router with the new debug setting.

Arguments

pr

A Plumber API. Note: The supplied Plumber API object will also be updated in place as well as returned by the function.

debug

TRUE provides more insight into your API errors.

Examples

Run this code
if (FALSE) {
# Will contain the original error message
pr() %>%
  pr_set_debug(TRUE) %>%
  pr_get("/boom", function() stop("boom")) %>%
  pr_run()

# Will NOT contain an error message
pr() %>%
  pr_set_debug(FALSE) %>%
  pr_get("/boom", function() stop("boom")) %>%
  pr_run()
}

Run the code above in your browser using DataLab