ReportErrors {RNetica} | R Documentation |
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.
ReportErrors(maxreport = 9, clear = TRUE, session=getDefaultSession()) ClearAllErrors(severity="XXX_ERR",session=getDefaultSession())
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): |
session |
An object of class |
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
).
ReportErrors()
returns a count of the number of errors of
severity "ERROR_ERR"
or higher.
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.
Russell Almond
http://norsys.com/onLineAPIManual/index.html: GetError_ns(), ClearError_ns()
StopNetica()
– should be called after
"XXX_ERROR"
is signaled by Netica.
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)