vendored/puppet/lib/puppet/forge/errors.rb in bolt-0.11.0 vs vendored/puppet/lib/puppet/forge/errors.rb in bolt-0.12.0

- old
+ new

@@ -30,16 +30,16 @@ # Return a multiline version of the error message # # @return [String] the multiline version of the error message def multiline - _(<<-EOS).chomp % { uri: @uri } -Could not connect via HTTPS to %{uri} - Unable to verify the SSL certificate - The certificate may not be signed by a valid CA - The CA bundle included with OpenSSL may not be valid or up to date - EOS + message = [] + message << _('Could not connect via HTTPS to %{uri}') % { uri: @uri } + message << _(' Unable to verify the SSL certificate') + message << _(' The certificate may not be signed by a valid CA') + message << _(' The CA bundle included with OpenSSL may not be valid or up to date') + message.join("\n") end end # This exception is raised when there is a communication error when connecting # to the forge @@ -57,16 +57,16 @@ # Return a multiline version of the error message # # @return [String] the multiline version of the error message def multiline - _(<<-EOS).chomp % { uri: @uri, detail: @detail } -Could not connect to %{uri} - There was a network communications problem - The error we caught said '%{detail}' - Check your network connection and try again - EOS + 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 end # This exception is raised when there is a bad HTTP response from the forge # and optionally a message in the response. @@ -88,35 +88,27 @@ end rescue JSON::ParserError end message = if @message - _("Request to Puppet Forge failed. Detail: %{error_message} / %{http_response}.") % - { error_message: @message, http_response: @response } + _("Request to Puppet Forge failed.") + ' ' + _("Detail: %{detail}.") % { detail: "#{@message} / #{@response}" } else - _("Request to Puppet Forge failed. Detail: %{http_response}.") % { http_response: @response } + _("Request to Puppet Forge failed.") + ' ' + _("Detail: %{detail}.") % { detail: @response } end super(message, original) end # Return a multiline version of the error message # # @return [String] the multiline version of the error message def multiline - if @message - _(<<-EOS).chomp % { uri: @uri, response: @response, message: @message } -Request to Puppet Forge failed. - The server being queried was %{uri} - The HTTP response we received was '%{response}' - The message we received said '%{message}' - EOS - else - _(<<-EOS).chomp % { uri: @uri, response: @response } -Request to Puppet Forge failed. - The server being queried was %{uri} - The HTTP response we received was '%{response}' - EOS - end + + message = [] + message << _('Request to Puppet Forge failed.') + message << _(' The server being queried was %{uri}') % { uri: @uri } + message << _(" The HTTP response we received was '%{response}'") % { response: @response } + message << _(" The message we received said '%{message}'") % { message: @message } if @message + message.join("\n") end end end