After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 300610 - G_TYPE_ERROR (boxed type for GError) missing
G_TYPE_ERROR (boxed type for GError) missing
Status: RESOLVED DUPLICATE of bug 614541
Product: glib
Classification: Platform
Component: gobject
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
: 337092 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-04-14 13:52 UTC by Andreas Rottmann
Modified: 2010-04-23 12:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch adding G_TYPE_ERROR incl. docs (3.02 KB, patch)
2005-04-19 16:10 UTC, Tim-Philipp Müller
none Details | Review
gboxed-error.diff (2.15 KB, patch)
2005-07-06 21:06 UTC, Roger Leigh
none Details | Review

Description Andreas Rottmann 2005-04-14 13:52:55 UTC
It would be nice to have a G_TYPE_ERROR covering GError in gboxed.h. I need
this, since I use GError in several places as signal parameter. If you think
this is a good idea, I can come up with a (simple) patch against CVS.
Comment 1 Tim-Philipp Müller 2005-04-19 16:10:13 UTC
Created attachment 45446 [details] [review]
patch adding G_TYPE_ERROR incl. docs 

The GStreamer folks would probably also prefer to see this in GLib rather than
register their own GstGError type as they do now.
Comment 2 Matthias Clasen 2005-04-28 21:00:14 UTC
GError is almost a parametrisized type, since you usually have a (set of)
allowed error domains and possible error codes around. We have always resisted
adding GTypes for the parametrisized container types in GLib. Also, the GType
would not be really useful for the most common use of GError, namely passing an
GError as an out parameter...
Comment 3 Tim-Philipp Müller 2005-04-29 08:45:58 UTC
I can see the argument from a theoretical point of view, but I still think it
makes sense to add a G_TYPE_ERROR. 

The type may not be particularly useful for GLib/Gtk itself, but it is useful in
order to maintain a consistent API in other GLib-based libraries. I thought the
whole point of GError was to have a consistent way of error handling and
notification within the 'G platform'.

I can't see how passing three callback arguments instead of one (error code,
domain and message) provides a consistent API (not to mention that it's clunky).
Having 'GstGError *' types details about which cannot be found anywhere in the
API reference can probably be remedied by some gtk-doc magic at the end of the
day, but it's still ugly.

Other libraries just use GError differently than GLib. The costs of the type are
extremely low, and there are already at least two libraries who like to have
this type, so I don't see much reason not to include it, theoretical reasons aside.

Cheers
 -Tim
Comment 4 Roger Leigh 2005-07-06 21:06:28 UTC
Created attachment 48745 [details] [review]
gboxed-error.diff

This patch implements two boxed types:

G_TYPE_ERROR (GError) and
G_TYPE_ERROR_POINTER (GError*, typedef'd as GErrorPointer)

The latter allows GError to be used in closures and signals as an "out"
parameter.  I would consider this to be a good addition to GObject; I currently
have it implemented in my own code, but being able to propagate errors through
callbacks would be a useful ability.

Regards,
Roger
Comment 5 Christian Persch 2010-04-01 10:05:57 UTC
*** Bug 337092 has been marked as a duplicate of this bug. ***
Comment 6 Tim-Philipp Müller 2010-04-23 10:02:35 UTC
A boxed type for GError has now been added in GLib 2.25.2, see bug #614541. (Thanks!)
Comment 7 Murray Cumming 2010-04-23 12:45:11 UTC

*** This bug has been marked as a duplicate of bug 614541 ***