mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 15:36:17 +01:00
gmessages: Mention g_return_if_fail() in g_warning() and g_error() docs
It seems to be common for people to use g_warning() or g_error() as pre- and post-condition error reporting functions, which is not really what they’re intended for. Similarly, it is generally a sign of bad API design to use g_warning() to report errors — use GError instead. Try and suggest this to the user in the hope that nice code results. https://bugzilla.gnome.org/show_bug.cgi?id=741779
This commit is contained in:
parent
ef1ba452b3
commit
5a642651c7
@ -180,6 +180,10 @@
|
||||
*
|
||||
* A convenience function/macro to log a warning message.
|
||||
*
|
||||
* This is not intended for end user error reporting. Use of #GError is
|
||||
* preferred for that instead, as it allows calling functions to perform actions
|
||||
* conditional on the type of error.
|
||||
*
|
||||
* You can make warnings fatal at runtime by setting the `G_DEBUG`
|
||||
* environment variable (see
|
||||
* [Running GLib Applications](glib-running.html)).
|
||||
@ -217,6 +221,10 @@
|
||||
*
|
||||
* A convenience function/macro to log an error message.
|
||||
*
|
||||
* This is not intended for end user error reporting. Use of #GError is
|
||||
* preferred for that instead, as it allows calling functions to perform actions
|
||||
* conditional on the type of error.
|
||||
*
|
||||
* Error messages are always fatal, resulting in a call to
|
||||
* abort() to terminate the application. This function will
|
||||
* result in a core dump; don't use it for errors you expect.
|
||||
|
Loading…
Reference in New Issue
Block a user