]> code.delx.au - pulseaudio/commitdiff
pulse: Document general error handling.
authorPeter Meerwald <pmeerw@pmeerw.net>
Sun, 8 Jan 2012 10:13:37 +0000 (11:13 +0100)
committerTanu Kaskinen <tanuk@iki.fi>
Sat, 28 Jan 2012 13:07:20 +0000 (15:07 +0200)
src/pulse/pulseaudio.h

index bb71772400ea047d092120b854da1b7b36e748a7..21b7213f8635a3f2fc1bc1689cdb801b2da619a7 100644 (file)
  * to make sure event objects are not manipulated when any other code is
  * using the main loop.
  *
+ * \section error_sec Error Handling
+ *
+ * Every function should explicitly document how errors are reported to
+ * the caller. Unfortunately, currently a lot of that documentation is
+ * missing. Here is an overview of the general conventions used.
+ *
+ * The PulseAudio API indicates error conditions by returning a negative
+ * integer value or a NULL pointer. On success, zero or a positive integer
+ * value or a valid pointer is returned.
+ *
+ * Functions of the \ref simple generally return -1 or NULL on failure and
+ * can optionally store an error code (see ::pa_error_code) using a pointer
+ * argument.
+ *
+ * Functions of the \ref async return an negative error code or NULL on
+ * failure (see ::pa_error_code). In the later case, pa_context_errno()
+ * can be used to obtain the error code of the last failed operation.
+ *
+ * An error code can be turned into a human readable message using
+ * pa_strerror().
+ *
  * \section pkgconfig pkg-config
  *
  * The PulseAudio libraries provide pkg-config snippets for the different