Home Contents | # cgi:error | Httpd/CGI | Core4 Lua Event System

## SYNOPSIS

cgi:error(status, title [, text [, extra]])

## DESCRIPTION

Sends a http error response. When no data has been sent to the client yet, it will send an http error header first. If the header has already been sent, it will simply insert a readable error message in HTML, assuming that the header that was already sent indicated the content-type text/html.

The value of status is the three digit HTTP error code to send. For example 404 means not found. See Wikipedia for a list of status codes.

The variable title will be made the title of the error message. Usually there is a well-known title for each three-digit error code you should stick to. But it is possible to use any readable string.

Additional descriptive text can be added to the error page. This can be plain text or HTML.

If necessary, additional lines can be added to the header in extra. These lines must be already formatted for use with HTTP in the form of Name: Value. When adding multiple lines separate them with CRLF, but do not add a CRLF to the end of the extra header.

## SEE ALSO

cgi:addheader(), cgi:cookie(), cgi:redirect()