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.

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

if (FALSE) {
stop_html("Resource doesn't exist", code = 404L)
}