dreamworkAPI
Ctrl K
GitHub
classDocs / HTTPError

HTTPError

classsharedmenusource
Object → Error → HTTPError

An error raised when an HTTP request fails or its response has an unexpected status code.

status is nil when no response was received (connection, TLS, timeout, ...).

lua
HTTPError( 404, "https://example.com/a" ) -- "HTTP 404 Not Found - Resource not found (url: https://example.com/a)"
HTTPError( nil, "https://example.com/a", "Timeout was reached" ) -- "HTTP request failed: Timeout was reached (url: https://example.com/a)"
HTTPError.Messages[ 429 ] -- "Too Many Requests - Rate limit exceeded"

Constructor

HTTPError(status: ( integer | nil ), url: ( string | nil ), message: ( string | nil )): HTTPError

Fields

NameTypeDescription
messagestring | nilThe reason of the failure, or extra details about the status code.
statusinteger | nilThe response status code, nil if no response was received.
urlstring | nilThe URL of the request.
Messagestable<integer, string>The status code description lookup table.

Inherited methods

From Error 5
Generated from the dreamwork meta branch.