ddetommaso / TobiiGlassesPyController

Tobii Pro Glasses 2 Python controller
GNU General Public License v3.0
56 stars 28 forks source link

Using quit() is unfriendly to external apps #13

Closed rmaronson closed 4 years ago

rmaronson commented 4 years ago

The current class calls quit() when the connection fails. This works poorly when integrated into other processes that might want to do custom error handling. It would be better to raise an exception (possibly ConnectionError or a custom error), and then the calling application can do better error handling.

This should be a simple change (replace both instances of quit() with e.g. raise ConnectionError("Failed to connect to Tobii device")). I can submit a PR if that's useful, assuming you can determine the appropriate exception type.

ddetommaso commented 4 years ago

Hi @rmaronson,

I think it's very useful change! I'll commit in a while. Thanks for sharing!

ddetommaso commented 4 years ago

fixed in this commit