Este conteúdo não está disponível no idioma selecionado.

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
Copy to Clipboard Toggle word wrap
Voltar ao topo
Red Hat logoGithubredditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar. Explore nossas atualizações recentes.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja o Blog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

Theme

© 2025 Red Hat