report_ns* GetError_ns ( environ_ns*  env,   errseverity_ns  severity,   const report_ns*  after )

If after is NULL, this returns a report for the first error in environment env which is at least as serious as severity.

If after is an error report currently in env, then the next error after it (at least as serious as severity) will be returned. This can be used to step through the errors, as shown in the second example below.

If there is no such error to be returned, GetError_ns returns NULL.

severity must be one of NOTHING_ERR, REPORT_ERR, NOTICE_ERR, WARNING_ERR, ERROR_ERR, or XXX_ERR (for a description of these see ErrorSeverity_ns).

This function can be used to report every error condition detected by (or occurring within) any Netica function except InitNetica2_bn and CloseNetica_bn (for these two functions you should use their return values to check for errors), and NewNeticaEnviron_ns (its errors will be detected by the subsequent call to InitNetica2_bn).

Use ErrorNumber_ns to get its error number, and ErrorMessage_ns to get an error message for it.

Multithreading Note. In a multithreading environment, GetError_ns is well-behaved in that it only returns errors that were caused by the current (the calling) thread.


This function is available in all versions.

See also:

ErrorMessage_ns    Gets a message for the error report
ErrorNumber_ns    Gets the identification number for the error report
ErrorSeverity_ns    Returns how serious the error is
ClearError_ns    Removes the error report from the system


// The following prints each serious error and then removes it
while ((error = GetError_ns (env, ERROR_ERR, NULL)) != NULL){
    printf ("%s\n", ErrorMessage_ns (error));
    ClearError_ns (error);
Example 2:
The following function is available in NeticaEx.c:
// This function prints all the serious errors (without removing them) // that are currently registered with the environment in global variable 'env'. // void PrintErrors (void){ report_ns* error = NULL; while (1) { error = GetError_ns (env, ERROR_ERR, error); if (!error) break; printf ("%s\n", ErrorMessage_ns (error)); } }