Find error classes

find_error_class(status_code)

Arguments

status_code

(numeric,integer) A status code

Value

an object of class R6ClassGenerator. call $new()to initialize a new instance

See also

Examples

find_error_class(414)
#> <HTTPRequestURITooLong> object generator
#>   Inherits from: <Error>
#>   Public:
#>     name: HTTPRequestURITooLong
#>     status_code: 414
#>     mssg: The server is refusing to service the request because th ...
#>     do_verbose: function (response, template = self$message_template_verbose) 
#>     clone: function (deep = FALSE) 
#>   Parent env: <environment: 0x555b05472a38>
#>   Locked objects: TRUE
#>   Locked class: FALSE
#>   Portable: TRUE
find_error_class(418)
#> <HTTPTeaPot> object generator
#>   Inherits from: <Error>
#>   Public:
#>     name: HTTPTeaPot
#>     status_code: 418
#>     mssg: 
#>     do_verbose: function (response, template = self$message_template_verbose) 
#>     clone: function (deep = FALSE) 
#>   Parent env: <environment: 0x555b080f4e48>
#>   Locked objects: TRUE
#>   Locked class: FALSE
#>   Portable: TRUE
find_error_class(505)
#> <HTTPHTTPVersionNotSupported> object generator
#>   Inherits from: <Error>
#>   Public:
#>     name: HTTPHTTPVersionNotSupported
#>     status_code: 505
#>     mssg: The server does not support, or refuses to support, the  ...
#>     do_verbose: function (response, template = self$message_template_verbose) 
#>     clone: function (deep = FALSE) 
#>   Parent env: <environment: 0x555b08d92c00>
#>   Locked objects: TRUE
#>   Locked class: FALSE
#>   Portable: TRUE

# initialize the class
find_error_class(418)$new()
#> <HTTPTeaPot>
#>   behavior: stop
#>   message_template: {{reason}} (HTTP {{status}})
#>   message_template_verbose: {{reason}} (HTTP {{status}}).\n - {{message}}

# not found
if (FALSE) find_error_class(999)