Michael Pasternak has uploaded a new change for review. Change subject: sdk: support app. server errors ......................................................................
sdk: support app. server errors Change-Id: If08af4b2553f7c98357ae01ef2ff510514f643ff Signed-off-by: Michael Pasternak <[email protected]> --- M src/ovirtsdk/infrastructure/errors.py 1 file changed, 11 insertions(+), 10 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-sdk refs/changes/13/7413/1 diff --git a/src/ovirtsdk/infrastructure/errors.py b/src/ovirtsdk/infrastructure/errors.py index 78f130d..aa09da1 100644 --- a/src/ovirtsdk/infrastructure/errors.py +++ b/src/ovirtsdk/infrastructure/errors.py @@ -38,7 +38,9 @@ detail = '' RESPONSE_FORMAT = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' RESPONSE_FAULT_BODY = '<fault>' + APP_SERVER_RESPONSE_FORMAT = '<html><head><title>JBoss Web' + #REST error if res and res.startswith(RESPONSE_FORMAT) and res.find(RESPONSE_FAULT_BODY) != -1: try: f_detail = params.parseString(res) @@ -58,16 +60,15 @@ if detail.startswith('[') and detail.endswith(']'): detail = detail[1:len(detail) - 1] - #application server error - if detail.startswith('<html>'): - start = detail.find('<h1>') - end = detail.find('</h1>') - if start != -1 and end != -1: - detail = detail[start:end].replace('<h1>', '').replace('</h1>', '') - if detail and detail.endswith(' - '): - detail = detail[:len(detail) - 3] - else: - detail = '\n' + res if res else '' + #application server error + elif res.startswith(APP_SERVER_RESPONSE_FORMAT): + detail = res + start = detail.find('<h1>') + end = detail.find('</h1>') + if start != -1 and end != -1: + detail = detail[start:end].replace('<h1>', '').replace('</h1>', '') + if detail and detail.endswith(' - '): + detail = detail[:len(detail) - 3] else: detail = '\n' + res if res else '' -- To view, visit http://gerrit.ovirt.org/7413 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If08af4b2553f7c98357ae01ef2ff510514f643ff Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine-sdk Gerrit-Branch: master Gerrit-Owner: Michael Pasternak <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
