Added proper exception handling for libvirt errors.