Handle ConnectionError when retrieving user id
If the machine is not connected to the network getting the user uuid in MutableMic.__init__ will fail, raising ConnectionError. This caused the speech client to crash.
Adding handler for ConnectionError resolves this issue.
@@ -31,7 +31,7 @@ from speech_recognition import (
AudioSource,
AudioData
)
-from requests import HTTPError
+import requests
from mycroft.api import DeviceApi
from mycroft.configuration import Configuration
@@ -189,7 +189,7 @@ class ResponsiveRecognizer(speech_recognition.Recognizer):
try:
self.account_id = DeviceApi().get()['user']['uuid']
- except (HTTPError, AttributeError):
+ except (requests.HTTPError, requests.ConnectionError, AttributeError):
self.account_id = '0'
@staticmethod
