class PuppetForge::ErrorWithDetail

Public Class Methods

from_response(response) click to toggle source
# File lib/puppet_forge/error.rb, line 33
def self.from_response(response)
  body = JSON.parse(response[:body])

  message = body['message']
  if body.key?('errors') && !body['errors']&.empty?
    message << "\nThe following errors were returned from the server:\n - #{body['errors'].join("\n - ")}"
  end

  new(message)
end