Este contenido no está disponible en el idioma seleccionado.

3.9. Handling Errors


Where errors are encountered the Software Development Kit uses exceptions to highlight them. The Software Development Kit defines exception types in addition to those defined by the Python interpreter itself. These exceptions are located in the ovirtsdk.infrastructure.errors module:
ConnectionError
Raised when a transport layer error has occurred.
DisconnectedError
Raised when attempting to use SDK after it was explicitly disconnected.
ImmutableError
Raised when initiating SDK while an SDK instance already exists under the same domain. Applicable to SDK version 3.2 and higher.
NoCertificatesError
Raised when no CA is provided and --insecure is 'False'.
RequestError
Raised at any kind of oVirt server error.
UnsecuredConnectionAttemptError
Raised when HTTP protocol is used while server is running HTTPS.
MissingParametersError
Raised when you are trying to use get() method without providing either id or name.
These exceptions can be caught and handled like any other Python exception:

Example 3.9. Catching a ConnectionError Exception

from ovirtsdk.api import API
from ovirtsdk.xml import params

try:
    api = API(url="https://HOST",
              user="USER,
              pass="PASS,
              ca_file="/etc/pki/ovirt-engine/ca.pem")
except ConnectionError, err:
    print "Connection failed: %s" % err
Red Hat logoGithubRedditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

© 2024 Red Hat, Inc.