Define TVM_FFI_RET_CHECK

Define TVM_FFI_RET_CHECK#

Define Documentation#

TVM_FFI_RET_CHECK(cond, ErrorKind)#

Return a streamed error when the condition is false.

RET_ macros contain the return. The condition is evaluated once; streaming is evaluated only on failure. The while guard preserves an enclosing if/else.

Expected<int> Divide(int x, int y) {
  TVM_FFI_RET_CHECK(y != 0, ValueError) << "zero divisor";
  return x / y;
}