checkCallStatus function
void
checkCallStatus(
- UniffiRustCallStatusErrorHandler errorHandler,
- Pointer<
RustCallStatus> status
Implementation
void checkCallStatus(
UniffiRustCallStatusErrorHandler errorHandler,
Pointer<RustCallStatus> status,
) {
if (status.ref.code == CALL_SUCCESS) {
return;
} else if (status.ref.code == CALL_ERROR) {
throw errorHandler.lift(status.ref.errorBuf);
} else if (status.ref.code == CALL_UNEXPECTED_ERROR) {
if (status.ref.errorBuf.len > 0) {
throw UniffiInternalError.panicked(
FfiConverterString.lift(status.ref.errorBuf),
);
} else {
throw UniffiInternalError.panicked("Rust panic");
}
} else {
throw UniffiInternalError.panicked(
"Unexpected RustCallStatus code: \${status.ref.code}",
);
}
}