stop_html: Raise an error with an optional HTML status code for API...

View source: R/error-handling.R

stop_htmlR Documentation

Raise an error with an optional HTML status code for API Gateways

Description

This variation of stop can be used to raise an error with a specific error code. This is provided to the API Gateway to return an appropriate response. It had no use outside of invocations via an API Gateway.

If a status code is not provided, a generic "500" internal server error will be used.

Usage

stop_html(..., code = 500L)

Arguments

...

zero or more objects which can be coerced to character (and which are pasted together with no separator). This forms the error message.

code

HTTP status code to return (if applicable). Defaults to 500, which is a generic "Internal Server Error". This is used when errors are to be returned to an API Gateway.

Examples

## Not run: 
stop_html("Resource doesn't exist", code = 404L)

## End(Not run)

lambdr documentation built on Nov. 25, 2023, 5:08 p.m.