This exception is raised when there is a bad HTTP response from the forge and optionally a message in the response.
Return a multiline version of the error message
@return [String] the multiline version of the error message
# File lib/puppet/forge/errors.rb, line 101 def multiline message = "Request to Puppet Forge failed. The server being queried was #{@uri} The HTTP response we received was '#{@response}' ".chomp message << "\n The message we received said '#{@message}'" if @message message end
@option options [String] :uri The URI that failed @option options [String] :input The user’s input (e.g. module name) @option options [String] :message Error from the API response (optional) @option options [Net::HTTPResponse] :response The original HTTP response
# File lib/puppet/forge/errors.rb, line 78 def initialize(options) @uri = options[:uri] @message = options[:message] response = options[:response] @response = "#{response.code} #{response.message.strip}" begin body = JSON.parse(response.body) if body['message'] @message ||= body['message'].strip end rescue JSON::ParserError end message = "Request to Puppet Forge failed. Detail: " message << @message << " / " if @message message << @response << "." super(message, original) end