GNOME Bugzilla – Bug 743011
Minor additions to GError documentation
Last modified: 2015-09-28 15:08:38 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.
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.
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.
Review of attachment 294645 [details] [review]: looks fine
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).
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
(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.
Created attachment 312284 [details] [review] gerror: Document the disadvantages of using GError Follow-up from commit 04662a8667c8bf0a594f0c6db7291066c272ad38.
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
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.
Review of attachment 312286 [details] [review]: looks fine, thanks
Attachment 312286 [details] pushed as de04fd1 - gerror: Document the disadvantages of using GError