Throw an error from an endpoint. This function is intended to allow target functions to throw nice errors back through the API.
porcelain_stop(message, code = "ERROR", errors = NULL, status_code = 400L, ...)
The human-readable message of the error. Ignored
if errors
is given.
Optional code for the error - if not given, then
ERROR
is used. Ignored if errors
is given.
A named list of errors - use this to signal multiple error conditions as key/value pairs.
The HTTP status code to use. The default (400) means "bad request" which should be a reasonable catch-all for bad user data.
Additional named args to be included as fields in the
error response JSON. The values must be in format ready for
serialization to JSON using jsonlite::toJSON()
i.e. any unboxing
using jsonlite::unbox()
needs to already have been done.
Nothing, as this function throws an error