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

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of CommunicationError.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :uri (String)

    The URI that failed

  • :original (String)

    the original exception



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

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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return a multiline version of the error message

Returns:

  • (String)

    the multiline version of the error message



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

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