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

From Ondra Machacek <omachace@redhat.com>:
Ondra Machacek 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: I548ae621a025969fe2dbf086f49ba83ea52fc28f Bug-Url: https://bugzilla.redhat.com/1440292 Signed-off-by: Juan Hernandez <juan.hernandez@redhat.com> Signed-off-by: Ondra Machacek <omachace@redhat.com> (cherry picked from commit 5c1b391547a2c9d962818e0b31ba9bbb57b5e593) --- M sdk/lib/ovirtsdk4/__init__.py M sdk/tests/server.py 2 files changed, 62 insertions(+), 1 deletion(-) Approvals: Ondra Machacek: Verified; Looks good to me, approved Jenkins CI: Passed CI tests -- To view, visit https://gerrit.ovirt.org/75487 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I548ae621a025969fe2dbf086f49ba83ea52fc28f Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine-sdk Gerrit-Branch: sdk_4.1 Gerrit-Owner: Ondra Machacek <omachace@redhat.com> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Ondra Machacek <omachace@redhat.com> Gerrit-Reviewer: gerrit-hooks <automation@ovirt.org>
participants (1)
-
Code Review