1 <refentry id="referr"> 2 3 <refmeta> 4 <refentrytitle>ne_get_error</refentrytitle> 5 <manvolnum>3</manvolnum> 6 </refmeta> 7 8 <refnamediv> 9 <refname id="ne_get_error">ne_get_error</refname> 10 <refname id="ne_set_error">ne_set_error</refname> 11 <refpurpose>error handling for HTTP sessions</refpurpose> 12 </refnamediv> 13 14 <refsynopsisdiv> 15 16 <funcsynopsis> 17 18 <funcsynopsisinfo>#include <ne_session.h></funcsynopsisinfo> 19 20 <funcprototype> 21 <funcdef>const char *<function>ne_get_error</function></funcdef> 22 <paramdef>ne_sesssion *<parameter>session</parameter></paramdef> 23 </funcprototype> 24 25 <funcprototype> 26 <funcdef>void <function>ne_set_error</function></funcdef> 27 <paramdef>ne_sesssion *<parameter>session</parameter></paramdef> 28 <paramdef>const char *<parameter>format</parameter></paramdef> 29 <paramdef>...</paramdef> 30 </funcprototype> 31 32 </funcsynopsis> 33 34 </refsynopsisdiv> 35 36 <refsect1> 37 <title>Description</title> 38 39 <para>The session error string is used to store any 40human-readable error information associated with any errors which 41occur whilst using the HTTP session.</para> 42 43 <para>The <function>ne_get_error</function> function returns 44 the current session error string. This string persists only 45 until it is changed by a subsequent operation on the session. 46 If localisation was enabled at build time, and if necessary 47 enabled at run-time if necessary using <xref 48 linkend="ne_i18n_init"/>, the returned string may have been 49 translated into the user's current locale.</para> 50 51 <para>The <function>ne_set_error</function> function can be 52 used to set a new session error string, using a 53 <function>printf</function>-style format string 54 interface.</para> 55 56 </refsect1> 57 58 <refsect1> 59 <title>Return value</title> 60 61 <para><function>ne_set_error</function> returns a constant 62 &nul;-terminated string. In the default English locale, the 63 returned string will <emphasis>not</emphasis> have a 64 terminating <quote>.</quote> period character.</para> 65 </refsect1> 66 67 <refsect1> 68 <title>Examples</title> 69 <para>Retrieve the current error string:</para> 70 <programlisting>&egsess; 71... 72printf("Error was: %s\n", ne_get_error(sess));</programlisting> 73 74 <para>Set a new error string:</para> 75 <programlisting>&egsess; 76... 77ne_set_error(sess, "Response missing header %s", "somestring");</programlisting> 78 </refsect1> 79 80 </refentry> 81