[libvirt] [PATCHv2 04/10] virErrorMsg: refactor to simplify common case