]> git.parisson.com Git - timeside-diadems.git/commitdiff
- merge all api's into timeside.api
authorOlivier Guilyardi <olivier@samalyse.com>
Fri, 27 Nov 2009 18:27:23 +0000 (18:27 +0000)
committerOlivier Guilyardi <olivier@samalyse.com>
Fri, 27 Nov 2009 18:27:23 +0000 (18:27 +0000)
- add core.get_processor()
- put all exceptions into exceptions.py
- use SubProcessError instead of EncodeProcesError, DecodeProcessError and VampProcessError
- rename TimeSideError to Error (= timeside.Error)

exceptions.py [new file with mode: 0644]

diff --git a/exceptions.py b/exceptions.py
new file mode 100644 (file)
index 0000000..40b4dcd
--- /dev/null
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2009 Olivier Guilyardi <olivier@samalyse.com>
+#
+# This file is part of TimeSide.
+
+# TimeSide is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+
+# TimeSide is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with TimeSide.  If not, see <http://www.gnu.org/licenses/>.
+
+class Error(Exception):
+    """Exception base class for errors in TimeSide."""
+
+class ApiError(Exception):
+    """Exception base class for errors in TimeSide."""
+
+class SubProcessError(Error):
+    """Exception for reporting errors from a subprocess"""
+
+    def __init__(self, message, command, subprocess):
+        self.message = message
+        self.command = str(command)
+        self.subprocess = subprocess
+
+    def __str__(self):
+        if self.subprocess.stderr != None:
+            error = self.subprocess.stderr.read()
+        else:
+            error = ''
+        return "%s ; command: %s; error: %s" % (self.message,
+                                                self.command,
+                                                error)