Exception: Gem::RemoteFetcher::FetchError

Inherits:
Exception show all
Includes:
UriParsing
Defined in:
lib/rubygems/remote_fetcher.rb

Overview

A FetchError exception wraps up the various possible IO and HTTP failures that could happen while downloading from the internet.

Direct Known Subclasses

UnknownHostError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, uri) ⇒ FetchError

Returns a new instance of FetchError.



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rubygems/remote_fetcher.rb', line 31

def initialize(message, uri)
  super message

  uri = parse_uri(uri)

  @original_uri = uri.dup

  uri.password = 'REDACTED' if uri.respond_to?(:password) && uri.password

  @uri = uri.to_s
end

Instance Attribute Details

#original_uriObject

The URI which was being accessed when the exception happened.



29
30
31
# File 'lib/rubygems/remote_fetcher.rb', line 29

def original_uri
  @original_uri
end

#uriObject

The URI which was being accessed when the exception happened.



29
30
31
# File 'lib/rubygems/remote_fetcher.rb', line 29

def uri
  @uri
end

Instance Method Details

#to_sObject

:nodoc:



43
44
45
# File 'lib/rubygems/remote_fetcher.rb', line 43

def to_s # :nodoc:
  "#{super} (#{uri})"
end