class

Krikri::PluginHelpers::HTTPDownload::FetchError

Inherits Exception < Reference < Object

A download that failed, carrying the pieces of Ansible's fetch_url result dict the CALLING module needs to build its own message around.

fetch_url never raises for a failed request - it catches everything and folds it into info:

  • urllib.error.HTTPError -> info['status'] = the code, info['msg'] = "HTTP Error : <reason>" (Kind::HttpError)
  • urllib.error.URLError -> info['status'] = -1 (it has no code), info['msg'] = "Request failed: <urlopen error ...>" (Kind::UrlError)
  • OSError (incl. socket.timeout, which is what a connect or response-head timeout is on the socket layer) -> status -1, info['msg'] = "Connection failure: <str(ex)>" (Kind::ConnectionFailure)

get_url's url_get then branches on that status alone: anything that is not 200 or 304 fails with response=info['msg'] plus a status_code, everything at -1 fails with msg=info['msg'] and no status_code at all. Kind::ContentCopy is the one failure that happens AFTER fetch_url returned (the staged write of the body died), which get_url's own copyfileobj handler reports with failed to create temporary content file: <reason> and elapsed alone.

Constructors

new(kind : Kind, info_msg : String, reason : String = "", status_code : Int32 | Nil = nil)
Source

Instance methods

info_msg

fetch_url's own info['msg'] text, verbatim.

Source
kind
Source
reason

str() of the exception behind a ContentCopy failure.

Source
status_code

The HTTP status, for Kind::HttpError only.

Source

Nested types