Change in ovirt-engine-sdk[sdk_4.0]: Raise SDK error for unknown tags

From Ondra Machacek <omachace@redhat.com>:
Ondra Machacek has submitted this change and it was merged. Change subject: Raise SDK error for unknown tags ...................................................................... Raise SDK error for unknown tags Currently when the SDK tries to read a document that contains an unknonwn tag, for example, a document that is actually HTML, it generates a 'KeyError' because it tries to access a dictionary that doesn't contain that tag as key. In this situation the SDK should instead generate a SDK error explaining that there is no reader for that tag. But that doesn't happen because we are accessing the dictionary with the '[]' operator, which generates the 'KeyError' when the key doesn't exist. To avoid that this patch changes the SDK so that it uses the 'get' method instead, and so that it raises an SDK error instead of an 'Exception'. Change-Id: Ifebb1d5d71dfdb3ccccae9ae0596d9fadc5ed1b9 Signed-off-by: Juan Hernandez <juan.hernandez@redhat.com> (cherry picked from commit 4a7fe15baaaaa80bcc48872b040c22913202ac75) (cherry picked from commit 1e1932b39efb04a558579114433a24bcdfc467bc) --- M sdk/lib/ovirtsdk4/reader.py M sdk/tests/test_reader.py 2 files changed, 17 insertions(+), 2 deletions(-) Approvals: Ondra Machacek: Verified; Looks good to me, approved Jenkins CI: Passed CI tests -- To view, visit https://gerrit.ovirt.org/69307 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifebb1d5d71dfdb3ccccae9ae0596d9fadc5ed1b9 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine-sdk Gerrit-Branch: sdk_4.0 Gerrit-Owner: Ondra Machacek <omachace@redhat.com> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Juan Hernandez <juan.hernandez@redhat.com> Gerrit-Reviewer: Ondra Machacek <omachace@redhat.com> Gerrit-Reviewer: gerrit-hooks <automation@ovirt.org>
participants (1)
-
Code Review