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 uniffiLiftOwnedRustBuffer(status.ref.errorBuf, errorHandler.lift);
} else if (status.ref.code == CALL_UNEXPECTED_ERROR) {
throw uniffiLiftOwnedRustBuffer(status.ref.errorBuf, (buf) {
return UniffiInternalError.panicked(
buf.len > 0 ? FfiConverterString.lift(buf) : "Rust panic",
);
});
} else {
throw UniffiInternalError.panicked(
"Unexpected RustCallStatus code: \${status.ref.code}",
);
}
}