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: 0x7fd27221c550>
#>   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: 0x7fd26fe84ce8>
#>   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: 0x7fd274591400>
#>   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)