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 743011 - Minor additions to GError documentation
Minor additions to GError documentation
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: docs
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2015-01-16 08:45 UTC by Philip Withnall
Modified: 2015-09-28 15:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gerror: Add an extra heading to the GError documentation (1.52 KB, patch)
2015-01-16 08:45 UTC, Philip Withnall
committed Details | Review
gerror: Document advantages of GError over numeric error codes (1.41 KB, patch)
2015-01-16 08:45 UTC, Philip Withnall
committed Details | Review
gerror: Document the disadvantages of using GError (1.58 KB, patch)
2015-09-28 12:24 UTC, Philip Withnall
none Details | Review
gerror: Document the disadvantages of using GError (3.34 KB, patch)
2015-09-28 12:33 UTC, Philip Withnall
committed Details | Review

Description Philip Withnall 2015-01-16 08:45:43 UTC
Two small patches to:
 • simplify linking to the really important bit of the GError documentation (the list of rules); and
 • give a brief justification of why people should use GError over numeric error codes.
Comment 1 Philip Withnall 2015-01-16 08:45:46 UTC
Created attachment 294645 [details] [review]
gerror: Add an extra heading to the GError documentation

This means that the top of the documentation can link forward to this
important section, and random people on the internet can link directly
to it on developer.gnome.org.
Comment 2 Philip Withnall 2015-01-16 08:45:50 UTC
Created attachment 294646 [details] [review]
gerror: Document advantages of GError over numeric error codes

Despite knowing about GError, there are multiple cases where developers
have still used traditional numeric error codes, and then got themselves
into a mess about bindability and generation of error messages.

Try and avoid this by including a brief paragraph on the benefits of
GError over EINVAL-style error codes.
Comment 3 Matthias Clasen 2015-09-28 12:06:17 UTC
Review of attachment 294645 [details] [review]:

looks fine
Comment 4 Matthias Clasen 2015-09-28 12:06:27 UTC
Review of attachment 294645 [details] [review]:

looks fine
Comment 5 Matthias Clasen 2015-09-28 12:11:57 UTC
Review of attachment 294646 [details] [review]:

I think this should be a discussion of tradeoffs instead of just an advertisement for GError. There are certainly downsides to using GError, such as memory allocation and string formatting overhead, the age-old question of 'do I wrap or not ?', etc. In particular, using GError in inner loops is a bad idea (G_IO_ERROR_WOULD_BLOCK says hi).
Comment 6 Philip Withnall 2015-09-28 12:12:50 UTC
Thanks for the review; pushed to master for 2.46.1.

Attachment 294645 [details] pushed as 5ceaeef - gerror: Add an extra heading to the GError documentation
Attachment 294646 [details] pushed as 04662a8 - gerror: Document advantages of GError over numeric error codes
Comment 7 Philip Withnall 2015-09-28 12:15:11 UTC
(In reply to Philip Withnall from comment #6)
> Thanks for the review; pushed to master for 2.46.1.

Whoops, assumed comment #4 was meant for attachment #294646 [details] and pushed everything. Follow-up patch on its way.
Comment 8 Philip Withnall 2015-09-28 12:24:09 UTC
Created attachment 312284 [details] [review]
gerror: Document the disadvantages of using GError

Follow-up from commit 04662a8667c8bf0a594f0c6db7291066c272ad38.
Comment 9 Matthias Clasen 2015-09-28 12:29:43 UTC
I'm not super-happy with the way this tradeoff discussion sits in the middle of the general introduction. I think it would be better to move it to a separate section below the rules, "Comparison of GError and traditional error handling" or so
Comment 10 Philip Withnall 2015-09-28 12:33:07 UTC
Created attachment 312286 [details] [review]
gerror: Document the disadvantages of using GError

And move the discussion to a new subsection in the GError documentation.
Follow-up from commit 04662a8667c8bf0a594f0c6db7291066c272ad38.
Comment 11 Matthias Clasen 2015-09-28 12:34:23 UTC
Review of attachment 312286 [details] [review]:

looks fine, thanks
Comment 12 Philip Withnall 2015-09-28 15:08:34 UTC
Attachment 312286 [details] pushed as de04fd1 - gerror: Document the disadvantages of using GError