Blob Blame History Raw
<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.78.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"><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"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include &lt;ne_session.h&gt;</pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><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" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><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"><a name="idm139901960086864"></a><h2>Description</h2><p>The session error string is used to store any
human-readable error information associated with any errors which
occur whilst using the HTTP session.</p><p>The <code class="function">ne_get_error</code> function returns
	the current session error string.  This string persists only
	until it is changed by a subsequent operation on the session.
	If localisation was enabled at build time, and if necessary
	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
	translated into the user's current locale.</p><p>The <code class="function">ne_set_error</code> function can be
        used to set a new session error string, using a
        <code class="function">printf</code>-style format string
        interface.</p></div><div class="refsect1"><a name="idm139901960082064"></a><h2>Return value</h2><p><code class="function">ne_set_error</code> returns a constant
        <code class="literal">NUL</code>-terminated string.  In the default English locale, the
        returned string will <span class="emphasis"><em>not</em></span> have a
        terminating <span class="quote">“<span class="quote">.</span>”</span> period character.</p></div><div class="refsect1"><a name="idm139901960078928"></a><h2>Examples</h2><p>Retrieve the current error string:</p><pre class="programlisting">ne_session *sess = ne_session_create(...);
...
printf("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(...);
...
ne_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>