From 6d4e3c4b785abd9fe5cc462b247e48b245835049 Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 14 Apr 2012 13:33:28 +0200 Subject: [PATCH] MPDCoverGrid: Try-Except-Bl?cke hinzugef?gt --- MPDCoverGrid.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/MPDCoverGrid.py b/MPDCoverGrid.py index cecba3b..8c54e65 100644 --- a/MPDCoverGrid.py +++ b/MPDCoverGrid.py @@ -17,11 +17,23 @@ class MPDCoverGrid: def connect(self): - self.client.connect(self._host, self._port) - if self._password: - self.client.password(self._password) + try: + self.client.connect(self._host, self._port) + if self._password: + self.client.password(self._password) + except CommandError as e: + # TODO Error + print(e) + except IOError as e: + # TODO Error + print(e) def disconnect(self): - self.client.disconnect() + try: + self.client.disconnect() + except IOError as e: + # TODO Error + print(e) + self.client = MPDClient()