diff --git a/lib/pact_broker/client/base_client.rb b/lib/pact_broker/client/base_client.rb index 48b82513..d1e6e6d7 100644 --- a/lib/pact_broker/client/base_client.rb +++ b/lib/pact_broker/client/base_client.rb @@ -70,7 +70,14 @@ def handle_response response else error_message = nil begin - error_message = JSON.parse(response.body)['errors'].join("\n") + errors = JSON.parse(response.body)['errors'] + error_message = if errors.is_a?(Array) + errors.join("\n") + elsif errors.is_a?(Hash) + errors.collect{ |key, value| "#{key}: #{value}" }.join("\n") + else + response.body + end rescue raise Error.new(response.body) end