Exception: Puppet::Forge::Errors::CommunicationError

Inherits:
ForgeError show all
Defined in:
lib/puppet/forge/errors.rb

Overview

This exception is raised when there is a communication error when connecting to the forge

Instance Attribute Summary

Attributes inherited from Error

#original

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ CommunicationError

Returns a new instance of CommunicationError

Options Hash (options):

  • :uri (String)

    The URI that failed

  • :original (String)

    the original exception


49
50
51
52
53
54
55
56
# File 'lib/puppet/forge/errors.rb', line 49

def initialize(options)
  @uri     = options[:uri]
  original = options[:original]
  @detail  = original.message

  message = _("Unable to connect to the server at %{uri}. Detail: %{detail}.") % { uri: @uri, detail: @detail }
  super(message, original)
end

Instance Method Details

#multilineString

Return a multiline version of the error message


61
62
63
64
65
66
67
68
# File 'lib/puppet/forge/errors.rb', line 61

def multiline
  message = []
  message << _('Could not connect to %{uri}') % { uri: @uri }
  message << _('  There was a network communications problem')
  message << _("    The error we caught said '%{detail}'") % { detail: @detail }
  message << _('    Check your network connection and try again')
  message.join("\n")
end