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 InitNetica_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 InitNetica_bn).

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

Version:

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

Example:

// 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:
// This function prints all the serious errors without removing them
//
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));
    }
}