In this tutorial, we will learn how to catch and handle errors/events in uTensor
.
We will implement our own handler, MyEventHandler
, which will spin-wait on errors/events of specific type. You can find its implementation in error_handle.cpp
.
To implement a handler, you must:
- inherit
ErrorHandler
, which is declared inerrorHandler.hpp
- (optional) override
uThrow
method, which will be invoked whenever an error has been thrown withContext::throwError
- (optional) override
notify
method, which will be invoked whenever an event has been notified withContext::notifyEvent
Running following commands in lldb
console:
(lldb) file tutorials/error_handling/error_handle
(lldb) b main
(lldb) run
You should see:
Enter c
to continue running:
The process spins because of an infinite loop in our handler. You can press ctrl+C
to stop the process and you will see:
At this point, you can do debugging in your program using commands such as bt
for back tracing, up
to go to upper function frame, f
for printing current frame, ...etc