err.xml 2.4 KB

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