Red Hat Bugzilla – Bug 1465328
[RFE] Add a hierarchy of exceptions
Last modified: 2017-09-27 08:46:36 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 hieararchy 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.
OvirtaSDK4::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.
The proposed patch adds the following exception classes:
AuthError - Raised when authentication of 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.