1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-12-09 12:23:48 +03:00

override: Simplify exception handling

sys.exc_info() returns a 3-tuple (type, value, traceback), where `value`
is the instance captured by `except type as value`.

Signed-off-by: Philipp Hahn <hahn@univention.de>
This commit is contained in:
Philipp Hahn
2018-11-20 08:59:35 +01:00
committed by Daniel Berrange
parent ec76ba3507
commit 67af8b910b

View File

@@ -3,17 +3,13 @@
# #
# On cygwin, the DLL is called cygvirtmod.dll # On cygwin, the DLL is called cygvirtmod.dll
import sys
try: try:
import libvirtmod import libvirtmod
except ImportError: except ImportError as lib_e:
lib_e = sys.exc_info()[1]
try: try:
import cygvirtmod as libvirtmod import cygvirtmod as libvirtmod
except ImportError: except ImportError as cyg_e:
cyg_e = sys.exc_info()[1] if "No module named" in str(cyg_e):
if str(cyg_e).count("No module named"):
raise lib_e raise lib_e