MartijnBraam / gpsd-py3

Python 3 GPSD client
105 stars 45 forks source link

AttributeError when not connected #23

Open faerics opened 4 years ago

faerics commented 4 years ago

Consider this script:

#!/usr/bin/env python3
import gpsd
#Get gps position not being connected to the server
packet = gpsd.get_current()

The user then gets an AttributeError not giving the direction where the actual error is.

Well, can a user try to get position not being connected? Definetely, yes, becase GPS often comes as an optional feature, so the system (whatever it is) continues working even if there is no GPS connection. So I propose to raise something more concrete saying there is no connection, like gpsd.NoConnectionError or gpsd.ConnectionError (second is better since more general)