pr_set_404 | R Documentation |
This function allows a custom error message to be returned when a request cannot be served by an existing endpoint or filter.
pr_set_404(pr, fun)
pr |
A Plumber API. Note: The supplied Plumber API object will also be updated in place as well as returned by the function. |
fun |
A handler function |
The Plumber router with a modified 404 handler
## Not run: handler_404 <- function(req, res) { res$status <- 404 res$body <- "Oops" } pr() %>% pr_get("/hi", function() "Hello") %>% pr_set_404(handler_404) %>% pr_run() ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.