Bug 1467969 - [RFE] Add a hierarchy of exceptions
[RFE] Add a hierarchy of exceptions
Status: VERIFIED
Product: ovirt-engine-sdk-python
Classification: oVirt
Component: Core (Show other bugs)
4.1.3
Unspecified Unspecified
low Severity medium (vote)
: ovirt-4.2.0
: ---
Assigned To: Ondra Machacek
Radim Hrazdil
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-05 13:00 EDT by Juan Hernández
Modified: 2017-11-16 08:21 EST (History)
6 users (show)

See Also:
Fixed In Version: python-ovirt-engine-sdk4-4.2.1-1.a3
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Infra
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
oourfali: ovirt‑4.2?
lsvaty: testing_plan_complete-
rule-engine: planning_ack?
rule-engine: devel_ack+
lsvaty: testing_ack+


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 83299 master MERGED Add specific exceptions 2017-10-31 04:42 EDT
oVirt gerrit 83534 master MERGED Add TimeoutError 2017-11-02 10:35 EDT

  None (edit)
Description Juan Hernández 2017-07-05 13:00:39 EDT
Currently when the SDK detects any kind of problem it raises ovirtsdk4.Error. The raise exception contains details about the error, like the HTTP error code, and the details of the error message generated by the engine. But when the error isn't HTTP related it is difficult to interpret it automatically, as the only information available is the error message. To improve this the SDK should instead provide a hierarchy of exception classes, and raise the ones that are relevant to the situation. This hierarchy should be rooted at the current ovirtsdk4.Error, and should contain at least the following exceptions:

  ovirtsdk4.NotFoundError - When the server returns a 400 HTTP error code.
  ovirtsdk4.TimeoutError - When a request fails after a timeout.
  ovirtsdk4.NoSuchHostError - When the host name can't be resolved.
  ovirtsdk4.UnauthorizedError - When the user isn't authorized.

The authentication error should be raised when the SSO service responds with an error or when the API responds with 401.
Comment 2 Ondra Machacek 2017-11-08 03:54:31 EST
Following errors was implemented:

AuthError - Raised when authentication or authorization fail.

ConnectionError - Raised when the name of the server can’t be resolved, and when the server is down or unreachable.

NotFoundError - Raised when the requested object doesn’t exist.

TimeoutError - Raised when an operation times out.
Comment 3 Radim Hrazdil 2017-11-16 08:21:21 EST
Verified new error classes in SDK ovirt-engine-sdk-python-4.2.1a3. Engine version 4.2.0-0.0.master.20171108151837.gita7de53e.el7.centos.

Note You need to log in before you can comment on or make changes to this bug.