puppetlabs/puppet — pull request #965 by kbarber (2012-07-24 19:00:27+00:00)
Title: (#15666) Include downstream error when raising CommunicationsError exception

Previously we were seeing errors being returned in the acceptance framework,
when the puppet module face had problems but the existing error message is far
too generic to be used to understand the root cause of such problems.

This patch changes the read_response code and CommunicationsError exceptions so
that the underlying comms error message is exposed to the client. The generic
message has been kept, but a new line 'Details:' has been added that will
expose the underlying error.

To make sure the generic error will catch and wrap the correct exceptions, we
have added a list of what we believe are the common exceptions that Net::HTTP
raises when remote or network problems occur. Other exceptions will continue to
be raised up to the face as per normal.

Test coverage has been added to make sure the exceptions behave as expected, as
this was lacking beforehand.