Exceptions
Error handling types across the RIK API.
ReaderException (C++)
Thrown by all C++ facade methods on failure. Extends RfIdeasException.
Header: ErrorHandling/ReaderException.h
Fields
| Field | Type | Description |
|---|---|---|
Message | std::string | Human-readable error description |
File | std::string | Source file where the error originated |
Line | int | Line number in the source file |
Function | std::string | Function that raised the error |
If the error originated from a protocol-level operation, additional protocol exception information is included with the same field layout.
Usage
try {
app->Init();
} catch (const ReaderException& e) {
std::cerr << "Error: " << e.Message << std::endl;
std::cerr << " at " << e.File << ":" << e.Line
<< " in " << e.Function << std::endl;
}
ReaderException (C#)
Thrown by all C# facade methods on failure. Wraps the underlying RikResult returned by the native C API.
Usage
try
{
app.Init();
}
catch (ReaderException ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
ReaderException (Python)
Raised by all Python facade methods on failure.
Usage
from reader_integration_kit.errors import ReaderException
try:
app.init()
except ReaderException as e:
print(f"Error: {e}")
RikResult (C API)
ABI-safe error struct returned by every C API function. Used instead of exceptions to communicate success or failure across the FFI boundary.
See the full struct definition and field descriptions in Structures — RikResult.
Fields (summary)
| Field | Type | Description |
|---|---|---|
HasException | bool | true if the call failed |
ExceptionType | char[256] | Exception class name |
Message | char[2048] | Human-readable error description |
FileName | char[2048] | Source file where the error originated |
LineNumber | int | Line number of the error |
FunctionName | char[256] | Function that raised the error |
HasProtocolException | bool | true if a protocol-level error also occurred |
Protocol* fields | Matching fields for the inner protocol exception |
Usage
RikResult result = {0};
Rik_Init(result, handle);
if (result.HasException) {
fprintf(stderr, "Error: %s\n", result.Message);
if (result.HasProtocolException) {
fprintf(stderr, "Protocol error: %s\n", result.ProtocolMessage);
}
}
Always zero-initialize RikResult before passing it to a C API function: RikResult result = {0};