From 44664f27966a0f5422a4701067ca9a2c8ee5c7d1 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Wed, 9 Jul 2014 22:17:46 +0200 Subject: [PATCH] exc: Add {Backend,Frontend,Mixer}Error exceptions (cherry picked from commit bf8307f329ce03b7a311d62aa50fdd7833048f32) --- mopidy/exceptions.py | 12 ++++++++++++ tests/test_exceptions.py | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/mopidy/exceptions.py b/mopidy/exceptions.py index 025d8fad..bf9b6dd9 100644 --- a/mopidy/exceptions.py +++ b/mopidy/exceptions.py @@ -16,9 +16,21 @@ class MopidyException(Exception): self._message = message +class BackendError(MopidyException): + pass + + class ExtensionError(MopidyException): pass +class FrontendError(MopidyException): + pass + + +class MixerError(MopidyException): + pass + + class ScannerError(MopidyException): pass diff --git a/tests/test_exceptions.py b/tests/test_exceptions.py index 3452a06b..47b3080d 100644 --- a/tests/test_exceptions.py +++ b/tests/test_exceptions.py @@ -12,10 +12,22 @@ class ExceptionsTest(unittest.TestCase): self.assertEqual(exc.message, 'foo') self.assertEqual(str(exc), 'foo') + def test_backend_error_is_a_mopidy_exception(self): + self.assert_(issubclass( + exceptions.BackendError, exceptions.MopidyException)) + def test_extension_error_is_a_mopidy_exception(self): self.assert_(issubclass( exceptions.ExtensionError, exceptions.MopidyException)) + def test_frontend_error_is_a_mopidy_exception(self): + self.assert_(issubclass( + exceptions.FrontendError, exceptions.MopidyException)) + + def test_mixer_error_is_a_mopidy_exception(self): + self.assert_(issubclass( + exceptions.MixerError, exceptions.MopidyException)) + def test_scanner_error_is_a_mopidy_exception(self): self.assert_(issubclass( exceptions.ScannerError, exceptions.MopidyException))