torayeff / fanucpy

Python Interface for FANUC robots
Apache License 2.0
109 stars 29 forks source link

Library-specific exception #6

Open ZdenekM opened 2 years ago

ZdenekM commented 2 years ago

Right now, the handle_response raises Exception: https://github.com/torayeff/fanucpy/blob/27a70d1c19f610f37cc196c7e97b1d682f37167e/src/fanucpy/Robot.py#L61

which is probably not a good practice. I propose to define at least one library-specific exception and optionally other derived exceptions... Something like this:

class FanucPyException(Exception):
    pass

class CommException(FanucPyException)
    pass

Which will allow me (in the application code) to catch just the specific exception raised by the library, instead of the generic one.

Thanks for your consideration.