|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /proc/21572/root/usr/share/gtk-doc/html/gconf/ |
Upload File : |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>GError</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
<link rel="start" href="index.html" title="GConf Reference Manual">
<link rel="up" href="ch01.html" title="Using the GConf library">
<link rel="prev" href="gconf-gconf-engine.html" title="GConfEngine">
<link rel="next" href="gconf-gconf-internals.html" title="gconf-internals">
<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="ch01.html" title="Using the GConf library">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="p" href="gconf-gconf-engine.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GConf Reference Manual</th>
<td><a accesskey="n" href="gconf-gconf-internals.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry" lang="en">
<a name="gconf-gconf-error"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle">GError</span></h2>
<p>GError —
error reporting.</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">
enum <a href="gconf-gconf-error.html#GConfError">GConfError</a>;
GError* <a href="gconf-gconf-error.html#gconf-error-new">gconf_error_new</a> (<a href="gconf-gconf-error.html#GConfError">GConfError</a> en,
const gchar *format,
...);
GQuark <a href="gconf-gconf-error.html#gconf-error-quark">gconf_error_quark</a> (void);
void <a href="gconf-gconf-error.html#gconf-set-error">gconf_set_error</a> (GError **err,
<a href="gconf-gconf-error.html#GConfError">GConfError</a> en,
const gchar *format,
...);
GError* <a href="gconf-gconf-error.html#gconf-compose-errors">gconf_compose_errors</a> (GError *err1,
GError *err2);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2528137"></a><h2>Description</h2>
<p>
The <span class="type">GError</span> object is used to report errors that occur in GConf
library routines. All functions that report errors work the same way:
</p>
<div class="itemizedlist"><ul type="disc">
<li><p>
The last argument to the function is a <span class="type">GError</span>**, a pointer to a
location where a <span class="type">GError</span>* can be placed.
</p></li>
<li><p>
This last argument may be <span class="symbol">NULL</span>, in which case no
error will be returned.
</p></li>
<li><p>
If non-<span class="symbol">NULL</span>, the argument should be the address of a
<span class="type">GError</span>* variable, which should be initialized to
<span class="symbol">NULL</span>.
</p></li>
<li><p>
If an error occurs, a <span class="type">GError</span> will be allocated and placed in the
return location; the caller must free the <span class="type">GError</span> with
<code class="function">g_error_free()</code>. If no error occurs, the return location will be
left untouched. That is, the test <code class="literal">error != NULL</code>
should always be a reliable indicator of whether the operation failed.
</p></li>
</ul></div>
<p>
</p>
<p>
It's also common that the return value of a function indicates whether
or not an error occurred. Typically, <span class="symbol">TRUE</span> is returned
on success. In some cases, a <span class="symbol">NULL</span> return value
indicates failure. Either way, if the return value indicates failure
and you passed a non-<span class="symbol">NULL</span> value for the last argument
to the function, a <span class="type">GError</span> will be returned. If the return value
indicates success, then a <span class="type">GError</span> will never be returned. These
relationships are guaranteed; that is, you can reliably use the return
value to decide whether a <span class="type">GError</span> was placed in the return
location. If a function does <span class="emphasis"><em>not</em></span> indicate
success/failure by return value, you must check whether the
<span class="type">GError</span> is <span class="symbol">NULL</span> to detect errors.
</p>
<p>
Here's a short error handling example:
</p>
<pre class="programlisting">
GError* err = NULL;
if (!gconf_init(&err))
{
fprintf(stderr, _("Failed to init GConf: <code class="literal">s</code>\n"), err->message);
g_error_free(err);
err = NULL;
}
</pre>
<p>
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2566997"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2567003"></a><h3>
<a name="GConfError"></a>enum GConfError</h3>
<a class="indexterm" name="id2567013"></a><pre class="programlisting">typedef enum {
GCONF_ERROR_SUCCESS = 0,
GCONF_ERROR_FAILED = 1, /* Something didn't work, don't know why, probably unrecoverable
so there's no point having a more specific errno */
GCONF_ERROR_NO_SERVER = 2, /* Server can't be launched/contacted */
GCONF_ERROR_NO_PERMISSION = 3, /* don't have permission for that */
GCONF_ERROR_BAD_ADDRESS = 4, /* Address couldn't be resolved */
GCONF_ERROR_BAD_KEY = 5, /* directory or key isn't valid (contains bad
characters, or malformed slash arrangement) */
GCONF_ERROR_PARSE_ERROR = 6, /* Syntax error when parsing */
GCONF_ERROR_CORRUPT = 7, /* Fatal error parsing/loading information inside the backend */
GCONF_ERROR_TYPE_MISMATCH = 8, /* Type requested doesn't match type found */
GCONF_ERROR_IS_DIR = 9, /* Requested key operation on a dir */
GCONF_ERROR_IS_KEY = 10, /* Requested dir operation on a key */
GCONF_ERROR_OVERRIDDEN = 11, /* Read-only source at front of path has set the value */
GCONF_ERROR_OAF_ERROR = 12, /* liboaf error */
GCONF_ERROR_LOCAL_ENGINE = 13, /* Tried to use remote operations on a local engine */
GCONF_ERROR_LOCK_FAILED = 14, /* Failed to get a lockfile */
GCONF_ERROR_NO_WRITABLE_DATABASE = 15, /* nowhere to write a value */
GCONF_ERROR_IN_SHUTDOWN = 16 /* server is shutting down */
} GConfError;
</pre>
<p>
The <a href="gconf-gconf-error.html#GConfError"><span class="type">GConfError</span></a> enumeration allows client applications to
differentiate between different kinds of error. You may wish to take
specific actions depending on the error type.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><code class="literal">GCONF_ERROR_SUCCESS</code></span></td>
<td>indicates that no error occurred, won't be returned in a <span class="type">GError</span>.
</td>
</tr>
<tr>
<td>
<span class="term"><code class="literal">GCONF_ERROR_FAILED</code></span></td>
<td>indicates failure, but no more specific <a href="gconf-gconf-error.html#GConfError"><span class="type">GConfError</span></a> applied.
</td>
</tr>
<tr>
<td>
<span class="term"><code class="literal">GCONF_ERROR_NO_SERVER</code></span></td>
<td>indicates that the GConf server couldn't be contacted, probably a CORBA problem.
</td>
</tr>
<tr>
<td>
<span class="term"><code class="literal">GCONF_ERROR_NO_PERMISSION</code></span></td>
<td>indicates that permission to access some resource was denied.
</td>
</tr>
<tr>
<td>
<span class="term"><code class="literal">GCONF_ERROR_BAD_ADDRESS</code></span></td>
<td>indicates that a configuration source address was syntactically invalid or impossible to resolve.
</td>
</tr>
<tr>
<td>
<span class="term"><code class="literal">GCONF_ERROR_BAD_KEY</code></span></td>
<td>indicates that a key was malformed.
</td>
</tr>
<tr>
<td>
<span class="term"><code class="literal">GCONF_ERROR_PARSE_ERROR</code></span></td>
<td>indicates that some parsing was done (perhaps in a backend) and it failed.
</td>
</tr>
<tr>
<td>
<span class="term"><code class="literal">GCONF_ERROR_CORRUPT</code></span></td>
<td>indicates that some part of the database is corrupt.
</td>
</tr>
<tr>
<td>
<span class="term"><code class="literal">GCONF_ERROR_TYPE_MISMATCH</code></span></td>
<td>indicates that a specific type was required, and another type was found.
</td>
</tr>
<tr>
<td>
<span class="term"><code class="literal">GCONF_ERROR_IS_DIR</code></span></td>
<td>indicates that an operation only applicable to keys was performed on a directory.
</td>
</tr>
<tr>
<td>
<span class="term"><code class="literal">GCONF_ERROR_IS_KEY</code></span></td>
<td>indicates that an operation only applicable to directories was performed on a key.
</td>
</tr>
<tr>
<td>
<span class="term"><code class="literal">GCONF_ERROR_OVERRIDDEN</code></span></td>
<td>indicates that the administrator has imposed a mandatory value, and it could not be changed.
</td>
</tr>
<tr>
<td>
<span class="term"><code class="literal">GCONF_ERROR_OAF_ERROR</code></span></td>
<td>
</td>
</tr>
<tr>
<td>
<span class="term"><code class="literal">GCONF_ERROR_LOCAL_ENGINE</code></span></td>
<td>
</td>
</tr>
<tr>
<td>
<span class="term"><code class="literal">GCONF_ERROR_LOCK_FAILED</code></span></td>
<td>
</td>
</tr>
<tr>
<td>
<span class="term"><code class="literal">GCONF_ERROR_NO_WRITABLE_DATABASE</code></span></td>
<td>
</td>
</tr>
<tr>
<td>
<span class="term"><code class="literal">GCONF_ERROR_IN_SHUTDOWN</code></span></td>
<td>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2536169"></a><h3>
<a name="gconf-error-new"></a>gconf_error_new ()</h3>
<a class="indexterm" name="id2536180"></a><pre class="programlisting">GError* gconf_error_new (<a href="gconf-gconf-error.html#GConfError">GConfError</a> en,
const gchar *format,
...);</pre>
<p>
Creates a new error. Normally the GConf library does this, but you
might find a reason to do it as well. <em class="parameter"><code>en</code></em> is the error number, <em class="parameter"><code>format</code></em>
is a <code class="function">printf()</code>-style format for the error message, and the variable
argument list is the same as in <code class="function">printf()</code>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>en</code></em> :</span></td>
<td>the error number.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>format</code></em> :</span></td>
<td>
<code class="function">printf()</code>-style format for error description.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>...</code></em> :</span></td>
<td>arguments required by the <em class="parameter"><code>format</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>newly-allocated <span class="type">GError</span>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2536327"></a><h3>
<a name="gconf-error-quark"></a>gconf_error_quark ()</h3>
<a class="indexterm" name="id2536337"></a><pre class="programlisting">GQuark gconf_error_quark (void);</pre>
<p>
Converts the string 'gconf-error-quark' to a <span class="type">GQuark</span> and returns the value.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>the <span class="type">GQuark</span> representing the string.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2536388"></a><h3>
<a name="gconf-set-error"></a>gconf_set_error ()</h3>
<a class="indexterm" name="id2536398"></a><pre class="programlisting">void gconf_set_error (GError **err,
<a href="gconf-gconf-error.html#GConfError">GConfError</a> en,
const gchar *format,
...);</pre>
<p>
Internal function.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>err</code></em> :</span></td>
<td>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>en</code></em> :</span></td>
<td>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>format</code></em> :</span></td>
<td>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>...</code></em> :</span></td>
<td>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2565818"></a><h3>
<a name="gconf-compose-errors"></a>gconf_compose_errors ()</h3>
<a class="indexterm" name="id2565827"></a><pre class="programlisting">GError* gconf_compose_errors (GError *err1,
GError *err2);</pre>
<p>
Internal function.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>err1</code></em> :</span></td>
<td>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>err2</code></em> :</span></td>
<td>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
<td align="left"><a accesskey="p" href="gconf-gconf-engine.html"><b><< GConfEngine</b></a></td>
<td align="right"><a accesskey="n" href="gconf-gconf-internals.html"><b>gconf-internals >></b></a></td>
</tr></table>
</body>
</html>