fonttools / pyclipper

Cython wrapper for the C++ translation of the Angus Johnson's Clipper library (ver. 6.4.2)
MIT License
233 stars 42 forks source link

Exceptions aren't translated to Python #16

Open thatch opened 6 years ago

thatch commented 6 years ago

For example, playing in the REPL I forgot to close a path:

>>> pco = pyclipper.PyclipperOffset()
>>> pc.AddPath([[0,0], [10,0], [10,10], [0, 10]], pyclipper.JT_ROUND, pyclipper.ET_CLOSEDPOLYGON)
terminate called after throwing an instance of 'ClipperLib::clipperException'
  what():  AddPath: Open paths must be subject.
Aborted (core dumped)
anthrotype commented 6 years ago

it's possible to declare such functions that may throw a c++ exception with an except +

http://cython.readthedocs.io/en/latest/src/userguide/wrapping_CPlusPlus.html#exceptions

would you like to work on a PR?