HELP!

How can I intercept runtime system Errors?

"Hard" runtime system errors are catastrophic errors which terminate inference should therefore be anticipated and prevented from occurring by the developer. If they do occur, then the developer may wish to log the generated error message to the server to enable them to be tracked and fixed.

An example of a hard error is "List value not covered by a decision tree branch". This occurs when a value not included in the List's value set is assigned by a script during inference.

It is possible to log such errors on the server using the xpertrule.writeLog method as shown in the following example:

Knowledge Base Settings -> Custom JavaScript (Advanced) -> Server-side JS -> Edit

function hardError(s) {
    xpertrule.writeLog(s, true);
    throw new inferenceIssue(PASSBACK_ERROR, "Error message displayed to the user");
}

The error log file on the server can be viewed using the Server Admin Console

The Error message can also be customised for display Browser Deployment to make them more client friendly by executing the following code at the start of inference:

    window.hardError = function (s) {
    console.log(s); 
    throw new inferenceIssue(PASSBACK_ERROR, "Whoops: a serious error has occurred. Please try again or contact the site administrator");
};

On This Page