1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>ne_get_error</title><link rel="stylesheet" type="text/css" href="../manual.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><link rel="home" href="index.html" title="neon HTTP/WebDAV client library"><link rel="up" href="ref.html" title="neon API reference"><link rel="prev" href="refbufdest.html" title="ne_buffer_destroy"><link rel="next" href="refgetst.html" title="ne_get_status"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">ne_get_error</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="refbufdest.html">Prev</a> </td><th width="60%" align="center">neon API reference</th><td width="20%" align="right"> <a accesskey="n" href="refgetst.html">Next</a></td></tr></table><hr></div><div class="refentry" title="ne_get_error"><a name="referr"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ne_get_error, ne_set_error — error handling for HTTP sessions</p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include &lt;ne_session.h&gt;</pre><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">const char *<b class="fsfunc">ne_get_error</b>(</code></td><td>ne_sesssion *<var class="pdparam">session</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <b class="fsfunc">ne_set_error</b>(</code></td><td>ne_sesssion *<var class="pdparam">session</var>, </td></tr><tr><td> </td><td>const char *<var class="pdparam">format</var>, </td></tr><tr><td> </td><td>...<code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1" title="Description"><a name="id451200"></a><h2>Description</h2><p>The session error string is used to store any
2human-readable error information associated with any errors which
3occur whilst using the HTTP session.</p><p>The <code class="function">ne_get_error</code> function returns
4	the current session error string.  This string persists only
5	until it is changed by a subsequent operation on the session.
6	If localisation was enabled at build time, and if necessary
7	enabled at run-time if necessary using <a class="xref" href="refi18n.html#ne_i18n_init">ne_i18n_init</a>, the returned string may have been
8	translated into the user's current locale.</p><p>The <code class="function">ne_set_error</code> function can be
9        used to set a new session error string, using a
10        <code class="function">printf</code>-style format string
11        interface.</p></div><div class="refsect1" title="Return value"><a name="id451241"></a><h2>Return value</h2><p><code class="function">ne_set_error</code> returns a constant
12        <code class="literal">NUL</code>-terminated string.  In the default English locale, the
13        returned string will <span class="emphasis"><em>not</em></span> have a
14        terminating <span class="quote">“<span class="quote">.</span>”</span> period character.</p></div><div class="refsect1" title="Examples"><a name="id451267"></a><h2>Examples</h2><p>Retrieve the current error string:</p><pre class="programlisting">ne_session *sess = ne_session_create(...);
15...
16printf("Error was: %s\n", ne_get_error(sess));</pre><p>Set a new error string:</p><pre class="programlisting">ne_session *sess = ne_session_create(...);
17...
18ne_set_error(sess, "Response missing header %s", "somestring");</pre></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="refbufdest.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ref.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="refgetst.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ne_buffer_destroy </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> ne_get_status</td></tr></table></div></body></html>
19