From: Olivier Guilyardi Date: Fri, 27 Nov 2009 18:27:23 +0000 (+0000) Subject: - merge all api's into timeside.api X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=95ee1e0878450713b25c6073efea50b86692e84f;p=timeside-diadems.git - merge all api's into timeside.api - add core.get_processor() - put all exceptions into exceptions.py - use SubProcessError instead of EncodeProcesError, DecodeProcessError and VampProcessError - rename TimeSideError to Error (= timeside.Error) --- diff --git a/exceptions.py b/exceptions.py new file mode 100644 index 0000000..40b4dcd --- /dev/null +++ b/exceptions.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# +# Copyright (c) 2009 Olivier Guilyardi +# +# 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 . + +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)