ne_get_error.3 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. '\" t
  2. .\" Title: ne_get_error
  3. .\" Author:
  4. .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
  5. .\" Date: 15 April 2025
  6. .\" Manual: neon API reference
  7. .\" Source: neon 0.34.2
  8. .\" Language: English
  9. .\"
  10. .TH "NE_GET_ERROR" "3" "15 April 2025" "neon 0.34.2" "neon API reference"
  11. .\" -----------------------------------------------------------------
  12. .\" * Define some portability stuff
  13. .\" -----------------------------------------------------------------
  14. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  15. .\" http://bugs.debian.org/507673
  16. .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
  17. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  18. .ie \n(.g .ds Aq \(aq
  19. .el .ds Aq '
  20. .\" -----------------------------------------------------------------
  21. .\" * set default formatting
  22. .\" -----------------------------------------------------------------
  23. .\" disable hyphenation
  24. .nh
  25. .\" disable justification (adjust text to left margin only)
  26. .ad l
  27. .\" -----------------------------------------------------------------
  28. .\" * MAIN CONTENT STARTS HERE *
  29. .\" -----------------------------------------------------------------
  30. .SH "NAME"
  31. ne_get_error, ne_set_error \- error handling for HTTP sessions
  32. .SH "SYNOPSIS"
  33. .sp
  34. .ft B
  35. .nf
  36. #include <ne_session\&.h>
  37. .fi
  38. .ft
  39. .HP \w'const\ char\ *ne_get_error('u
  40. .BI "const char *ne_get_error(ne_sesssion\ *" "session" ");"
  41. .HP \w'void\ ne_set_error('u
  42. .BI "void ne_set_error(ne_sesssion\ *" "session" ", const\ char\ *" "format" ", \&.\&.\&.);"
  43. .SH "DESCRIPTION"
  44. .PP
  45. The session error string is used to store any human\-readable error information associated with any errors which occur whilst using the HTTP session\&.
  46. .PP
  47. The
  48. \fBne_get_error\fR
  49. 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
  50. ne_i18n_init, the returned string may have been translated into the user\*(Aqs current locale\&.
  51. .PP
  52. The
  53. \fBne_set_error\fR
  54. function can be used to set a new session error string, using a
  55. \fBprintf\fR\-style format string interface\&.
  56. .SH "RETURN VALUE"
  57. .PP
  58. \fBne_set_error\fR
  59. returns a constant
  60. NUL\-terminated string\&. In the default English locale, the returned string will
  61. \fInot\fR
  62. have a terminating
  63. \(lq\&.\(rq
  64. period character\&.
  65. .SH "EXAMPLES"
  66. .PP
  67. Retrieve the current error string:
  68. .sp
  69. .if n \{\
  70. .RS 4
  71. .\}
  72. .nf
  73. ne_session *sess = ne_session_create(\&.\&.\&.);
  74. \&.\&.\&.
  75. printf("Error was: %s\en", ne_get_error(sess));
  76. .fi
  77. .if n \{\
  78. .RE
  79. .\}
  80. .PP
  81. Set a new error string:
  82. .sp
  83. .if n \{\
  84. .RS 4
  85. .\}
  86. .nf
  87. ne_session *sess = ne_session_create(\&.\&.\&.);
  88. \&.\&.\&.
  89. ne_set_error(sess, "Response missing header %s", "somestring");
  90. .fi
  91. .if n \{\
  92. .RE
  93. .\}
  94. .SH "COPYRIGHT"
  95. .br
  96. Copyright \(co 2001-2024 Joe Orton
  97. .br