PyRx
PyRx copied to clipboard
C++ Exceptions
Discussed in https://github.com/CEXT-Dan/PyRx/discussions/109
Originally posted by gswifort September 5, 2024
To make working with C++ exceptions easier I added tools to translate general C++ exceptions (RuntimeError
) to specific types. You can see the implementation here.
Usage looks like this:
text = Db.Text()
text_id = db.addToModelspace(text)
with cast_to_arx_exception:
Db.Text(text_id, Db.OpenMode.kForRead) # raises pyrx.exceptions.eWasOpenForWrite
I wonder if I should stick to this path or if you have a better idea..? Maybe you want to implement something similar in C++?