ReportErrors {RNetica}R Documentation

Reports internal Netica errors.

Description

This function is normally called at the end of other Netica calls to report out on any Netica errors. These functions are not normally needed at the user level.

Usage


ReportErrors(maxreport = 9, clear = TRUE, session=getDefaultSession())
ClearAllErrors(severity="XXX_ERR",session=getDefaultSession())

Arguments

maxreport

An integer giving the maximum number errors to report.

clear

A logical flag indicating if errors should be cleared as they are reported (default is to clear errors).

severity

A string giving one of the Netica error levels (in order of severity): "NOTHING_ERR", "REPORT_ERR", "NOTICE_ERR", "WARNING_ERR", "ERROR_ERR", "XXX_ERR".

session

An object of class NeticaSession which provides the link to the Netica environment. If not supplied, then the default value is the value of the function getDefaultSession() which is usually the value of DefaultNeticaSession in the global environment.

Details

More information about the severity levels of Netica errors can be found in the documentation for the Netica function GetError_ns. The ClearAllErrors() function clears all errors of the indicated severity and below.

Note that these functions are really just wrappers for session$reportErrors and session$clearErrors (see NeticaSession).

Value

ReportErrors() returns a count of the number of errors of severity "ERROR_ERR" or higher.

Note

At this point, the protocol is that the higher level RNetica functions all call ReportErrors() to report error messages and warnings and then throw an error (call stop()) whenever the error count is greater than one. These functions are probably not necessary in user level code.

As of version 0.5, this is modified so that functions follow the NeticaNode to the NeticaBN to the NeticaSession and then call the report error mechanism on that.

Future versions may use a more sophisticated error checking mechanism that allows for more user control.

There is currently a known bug where somehow ReportErrors keeps finding an error that indicates that there is an invalid error pointer (which keeps retriggering the error). Hopefully, that will be fixed in future versions.

Author(s)

Russell Almond

References

http://norsys.com/onLineAPIManual/index.html: GetError_ns(), ClearError_ns()

See Also

NeticaSession

StopNetica() – should be called after "XXX_ERROR" is signaled by Netica.

Examples


myCreateNetwork <- function (names,session) {
  handles <- .Call("RN_New_Net",as.character(names),session,PACKAGE="RNetica")
  ## Check for errors
  ecount <- ReportErrors()
  if (ecount[1]>0) { ## Stop if errors are encountered
    stop("CreateNetwork: Netica Errors Encountered, see console for details.")
  }
  handles
}
## Not run: 
ClearAllErrors(getDefaultSession())
getDefaultSession()$clearErrors()

## End(Not run)


[Package RNetica version 0.5-4 Index]