Skip to main content

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

FieldTypeDescription
Messagestd::stringHuman-readable error description
Filestd::stringSource file where the error originated
LineintLine number in the source file
Functionstd::stringFunction 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)

FieldTypeDescription
HasExceptionbooltrue if the call failed
ExceptionTypechar[256]Exception class name
Messagechar[2048]Human-readable error description
FileNamechar[2048]Source file where the error originated
LineNumberintLine number of the error
FunctionNamechar[256]Function that raised the error
HasProtocolExceptionbooltrue if a protocol-level error also occurred
Protocol* fieldsMatching 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);
}
}
tip

Always zero-initialize RikResult before passing it to a C API function: RikResult result = {0};


See Also