Note that in the new ffi, we have better backtrace support through lib 
backtrace, so right now if an exception is thrown from cxx end, the trace will 
be incorporated into the python trace and also clickable if we are in editors 
like vscode

```python
from tvm import ffi as tvm_ffi

def error_trace():
    # call a test function that raises error from c++ end
    cxx_test_raise_error = tvm_ffi.get_global_func("testing.test_raise_error")
    cxx_test_raise_error("ValueError", "error XYZ")

error_trace()
```

Will return something like

```bash
Traceback (most recent call last):
  File "/tvm/apps/debug.py", line 25, in <module>
    error_trace()
  File "/tvm/apps/debug.py", line 23, in error_trace
    cxx_test_raise_error("ValueError", "error XYZ")
  File "tvm/ffi/cython/function.pxi", line 228, in 
tvm.ffi.core.Function.__call__
    raise move_from_last_error().py_error()
  File "/tvm/ffi/src/ffi/testing.cc", line 30, in 
tvm::ffi::TestRaiseError(tvm::ffi::String, tvm::ffi::String)
    throw ffi::Error(kind, msg, TVM_FFI_TRACEBACK_HERE);
ValueError: error XYZ
```





---
[Visit 
Topic](https://discuss.tvm.apache.org/t/introducing-and-modernize-ffi-system/18304/5)
 to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.tvm.apache.org/email/unsubscribe/b042bdef26e5f81b277b93d2f70e02d31c22fe962b8d3a8c747137cb7944406f).

Reply via email to