APIs, concepts, guides, and more

◆ CheckErrors()

void CheckErrors ( RapidCodeObject * rsiObject,
const std::source_location & location = std::source_location::current() )
Parameters
rsiObjectPointer to the RapidCodeObject to check for errors.
locationSource location of the function call for error reporting.
Exceptions
std::runtime_errorThrown if any non-warning errors are encountered in the error log of the RapidCodeObject.
Code Snippet
void CheckErrors(RapidCodeObject *rsiObject, const std::source_location &location = std::source_location::current())
{
bool hasErrors = false;
std::string errorStrings("");
while (rsiObject->ErrorLogCountGet() > 0)
{
const RsiError *err = rsiObject->ErrorLogGet();
errorStrings += err->what();
errorStrings += "\n";
if (!err->isWarning)
{
hasErrors = true;
}
}
if (hasErrors)
{
std::ostringstream message;
message << "Error! In "
<< location.file_name() << '('
<< location.line() << ':'
<< location.column() << ") `"
<< location.function_name() << "`:\n"
<< errorStrings;
throw std::runtime_error(message.str().c_str());
}
}
See also
NetworkStart [CheckErrors]
Examples
_helpers.cs, axis-configuration.cpp, calculate-acceleration-from-velocity.cpp, config.h, difference-of-position-user-limit.cpp, hello-rttasks.cpp, helpers.h, phantom-axis.cpp, point-to-point.cpp, print-network-topology.cpp, random-walk.cpp, record-performance.cpp, and starter-template.cpp.

Definition at line 32 of file helpers.h.