Skip to content

Error

Error is raised for transport and protocol failures.

try
  get "http://127.0.0.1:1"
catch Error: err
  echo $Str(err)

str(err) returns the underlying error message.

Non-2xx HTTP responses are reported through Status.

When the underlying error carries a URL, Error exposes it through a url field:

try
  get "http://example.invalid"
catch Error: err
  if (err.url != nil)
    echo $err.url.host

Inherits