[Libvir] new ruby error handling
Richard W.M. Jones
rjones at redhat.com
Mon Apr 14 08:15:03 UTC 2008
On Sun, Apr 13, 2008 at 08:13:51PM -0700, Vadim Zaliva wrote:
> I guess my main complaint is that in some cases message is not a coherent
> English phrase, something I can show to users. So I would prefer to have
> "Error during call to XXX" instead of just "XXX".
[Not a direct answer about the Ruby bindings, but ...]
virterror is a confusing and over-engineered bit of code. It would
have been better just to raise string errors (as in Perl).
But anyway if you can call __virErrorMsg then you should be able to
translate the message into something (a) readable and (b) translated.
eg. Code in libvirt which does this:
qemudReportError (dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
should be translated like this in __virErrorMsg (note '_' which means
it gets translated):
_("this function is not supported by the hypervisor: %s")
Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
More information about the libvir-list