APIs, concepts, guides, and more

◆ ErrorLogGet()

const RsiError *const ErrorLogGet ( )
inherited
Description:
ErrorLogGet returns the next RsiError in the log.
Returns
(RsiError*) An error.
Sample Code:
Monitoring: Error Logging
// turn exceptions off (errors will be logged as RsiError objects)
controller.ThrowExceptions(false);
axis.ThrowExceptions(false);
// cause an errors
controller.RecorderStart(); // recorder count is zero
axis.MoveVelocity(0.0, 0.0); // zero acceleration
// print error count
var controllerErrorCount = controller.ErrorLogCountGet();
var axisErrorCount = axis.ErrorLogCountGet();
Console.WriteLine($"Controller error count: {controllerErrorCount} (expected: 1)");
Console.WriteLine($"Axis error count: {axisErrorCount} (expected: 1)");
// print controller errors
while(controller.ErrorLogCountGet() > 0)
{
// ErrorLogGet retrieves and removes the next error from the log
RsiError error = controller.ErrorLogGet();
Console.WriteLine($" Controller Error: {error.Message}");
}
// print axis errors
while( axis.ErrorLogCountGet() > 0)
{
RsiError error = axis.ErrorLogGet();
Console.WriteLine($" Axis Error: {error.Message}");
}
// print error count after reading logs
Console.WriteLine($"Controller error count: {controller.ErrorLogCountGet()} (expected: 0)");
Console.WriteLine($"Axis error count: {axis.ErrorLogCountGet()} (expected: 0)");
See also
ErrorLogCountGet
Examples
StreamingMotionBufferManagement.cpp, _helpers.cs, error-logs.cs, and helpers.h.