gijzelaerr / python-snap7

A Python wrapper for the snap7 PLC communication library
http://python-snap7.readthedocs.org/
MIT License
632 stars 246 forks source link

Snap7Exception is not used #519

Closed kustkust closed 1 month ago

kustkust commented 2 months ago

All methods raises a standart exceptions such as RuntimeError or ValueError, witch makes it difficult to handle errors from snap7 because they may mixup with other errors.

gijzelaerr commented 1 month ago

this is intentional, if you pass a wrong value to python-snap7 it will raise a value error. If you pass the wrong type to python-snap7 it will raise a type error. if something is wrong with the runtime (can't find DLL) snap7 will very quickly raise a runtime error. We didn't find the need anymore for our custom exception, since it was not adding a lot of value.

If you can come up with a good example where a specialised exception is very useful but is also backwards compatible, we are open to suggestions.