Change in ovirt-engine-sdk-ruby[sdk_4.1]: Improve error message for wrong content type

Code Review gerrit at ovirt.org
Wed Apr 12 12:49:51 UTC 2017


>From Juan Hernandez <juan.hernandez at redhat.com>:

Juan Hernandez has submitted this change and it was merged.

Change subject: Improve error message for wrong content type
......................................................................


Improve error message for wrong content type

Currently when the user specifies an incorrect URL path the SDK sends
requests to the server anyhow, and it tries to parse the response body
as XML, without checking the response content type. This generates error
messages that don't explain the root cause of the problem. To improve
that this patch changes the SDK so that it checks the content type of
the responses and generates error messages that explain better the
failure. For example, if the user specifies an incorrect URL path like
'/ugly', the SDK will try to contact the server and will raise an
exception containing the following error message:

  The response content type 'text/html; charset=iso-8859-1' isn't
  the expected XML. Is the path '/ugly' included in the 'url'
  parameter correct? The typical one is '/ovirt-engine/api'

Change-Id: I71857a3762288f6bb8f8fdda70ba0b2f88e75e83
Related-To: https://bugzilla.redhat.com/1440292
Signed-off-by: Juan Hernandez <juan.hernandez at redhat.com>
(cherry picked from commit ac41e70bbb168a16e55c03be27f2047ce2b9624e)
---
M sdk/lib/ovirtsdk4/connection.rb
1 file changed, 51 insertions(+), 0 deletions(-)

Approvals:
  Juan Hernandez: Verified; Looks good to me, approved
  Jenkins CI: Passed CI tests



-- 
To view, visit https://gerrit.ovirt.org/75485
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I71857a3762288f6bb8f8fdda70ba0b2f88e75e83
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-sdk-ruby
Gerrit-Branch: sdk_4.1
Gerrit-Owner: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>


More information about the Engine-commits mailing list