[libvirt] g_error considered harmful

Christophe Fergeau cfergeau at redhat.com
Mon Jan 30 17:52:16 UTC 2012


On Tue, Jan 17, 2012 at 04:52:19PM +0100, Christophe Fergeau wrote:
> Looking at what gtk+ does, it has gtk_init which is documented to abort,
> and gtk_init_check which apps can use when they need this. g_type_init has
> no _check alternative, but it does a few sanity checks at runtime using
> g_assert.
> 
> I like the gtk+ approach of aborting in the function most commonly use as
> it avoids tracking down bugs caused by the _init failing but not being
> checked by the application developer. I think we should do the same and add
> _check functions if/when needed (this is me being lazy)

Actually these _init_check functions already exist, so we have
libvirt_{glib,gconfig,gobject}_init which abort, and
libvirt_{glib,gconfig,gobject}_init_check which return FALSE and an error
when there's a problem during initilization.

This mail should be read as a "ping?" on this series :)

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120130/75be0365/attachment-0001.sig>


More information about the libvir-list mailing list