Freshwater Error Pages
error_pages.RdAdds request/error hooks to a plumber2::plumber2 API so that freshwater can render friendly HTML error pages for:
403 Forbidden responses
404 Not Found responses
500 Internal Server Error conditions
Usage
api_error_pages(
api,
handlers = NULL,
debug = plumber2::get_opts("fw_debug", default = interactive())
)Arguments
- api
a plumber2::plumber2 api object.
- handlers
optional list of named error templates. Supported keys are: "403", "404", "500". If omitted, freshwater installs default templates.
- debug
whether the 500 error template should render error messages and stack traces. Defaults to the
fw_debugplumber2 option, and falls back tointeractive().
Details
Custom error page templates can be supplied via the
handlers parameter. These should be freshwater templates
created via template(), and should match the call signatures of
the default error templates. See freshwater_error_templates for
the relevant template signatures required.
This middleware installs freshwater request context.