@@ -17,6 +17,9 @@ freely, subject to the following restrictions:
1717
18183. This notice may not be removed or altered from any source distribution.
1919-------------------------------------------------------------------------*/
20+ /**
21+ * \defgroup ErrorHandling Error Handling
22+ **/
2023
2124#include <stdlib.h>
2225#include <stdarg.h>
@@ -54,11 +57,35 @@ CGNSDLL void cgi_warning(const char *format, ...) {
5457 va_end (arg );
5558}
5659
57- CGNSDLL const char * cg_get_error () {
60+ /**
61+ * \ingroup ErrorHandling
62+ *
63+ * \brief If an error occurs during the execution of a CGNS library function,
64+ * signified by a non-zero value of the error status variable \p ier, an error
65+ * message may be retrieved using the function cg_get_error().
66+ *
67+ * \return The error message
68+ */
69+
70+ const char * cg_get_error () {
5871 return cgns_error_mess ;
5972}
6073
61- CGNSDLL void cg_error_exit () {
74+ /**
75+ * \ingroup ErrorHandling
76+ *
77+ * \brief Print the error message and stop the execution of the program
78+ *
79+ * \note In C, you may define a function to be called automatically in the case of a
80+ * warning or error using the cg_configure() routine. The function is of the form
81+ * \code void err_func(int is_error, char *errmsg) \endcode and will be called whenever an error
82+ * or warning occurs. The first argument, \p is_error, will be 0 for warning messages,
83+ * 1 for error messages, and -1 if the program is going to terminate
84+ * (i.e., a call to cg_error_exit()). The second argument is the error or warning message.
85+ *
86+ */
87+
88+ void cg_error_exit () {
6289 if (cgns_error_handler )
6390 (* cgns_error_handler )(-1 , cgns_error_mess );
6491 else
@@ -67,7 +94,21 @@ CGNSDLL void cg_error_exit() {
6794 exit (1 );
6895}
6996
70- CGNSDLL void cg_error_print () {
97+ /**
98+ * \ingroup ErrorHandling
99+ *
100+ * \brief Print the error message and continue execution of the program
101+ *
102+ * \note In C, you may define a function to be called automatically in the case of a
103+ * warning or error using the cg_configure() routine. The function is of the form
104+ * \code void err_func(int is_error, char *errmsg) \endcode and will be called whenever an error
105+ * or warning occurs. The first argument, \p is_error, will be 0 for warning messages,
106+ * 1 for error messages, and -1 if the program is going to terminate
107+ * (i.e., a call to cg_error_exit()). The second argument is the error or warning message.
108+ *
109+ */
110+
111+ void cg_error_print () {
71112 fprintf (stderr ,"%s\n" ,cgns_error_mess );
72113}
73114
0 commit comments