flexiv_rdk
flexiv_rdk copied to clipboard
[FEATURE] Catch exception by type in pyhton
Is your feature request related to a problem? Please describe. I cannot catch exceptions by type in python, python's generic RuntimeError is thrown instead.
Describe the solution you'd like I would like to be able to catch exceptions by the types defined in the C++ RDK, like this:
import flexivrdk
robot_ip = '192.168.1.100
local_ip = '192.168.1.101
try:
flexivrdk.robot(robot_ip, local_ip)
except flexivrdk.InitException as e:
# do some stuff
except flexivrdk.CompatibilityException:
exit(1)
except flexivrdk.CommException:
# do some other stuff
Describe alternatives you've considered I thought about parsing the exception's message string, but that required access to the source code to make sure all cases are covered, but I assume that is not possible
Additional context I am using python 3.10 on both x86_64 as well as arm64 machines I installed the corresponding .so libraries in /usr/local/lib/python3.10/site-packages/ on both machines