Package timeside :: Module exceptions
[hide private]
[frames] | no frames]

Source Code for Module timeside.exceptions

 1  # -*- coding: utf-8 -*- 
 2  # 
 3  # Copyright (c) 2009 Olivier Guilyardi <olivier@samalyse.com> 
 4  # 
 5  # This file is part of TimeSide. 
 6   
 7  # TimeSide is free software: you can redistribute it and/or modify 
 8  # it under the terms of the GNU General Public License as published by 
 9  # the Free Software Foundation, either version 2 of the License, or 
10  # (at your option) any later version. 
11   
12  # TimeSide is distributed in the hope that it will be useful, 
13  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
15  # GNU General Public License for more details. 
16   
17  # You should have received a copy of the GNU General Public License 
18  # along with TimeSide.  If not, see <http://www.gnu.org/licenses/>. 
19   
20 -class Error(Exception):
21 """Exception base class for errors in TimeSide."""
22
23 -class ApiError(Exception):
24 """Exception base class for errors in TimeSide."""
25
26 -class SubProcessError(Error):
27 """Exception for reporting errors from a subprocess""" 28
29 - def __init__(self, message, command, subprocess):
30 self.message = message 31 self.command = str(command) 32 self.subprocess = subprocess
33
34 - def __str__(self):
35 if self.subprocess.stderr != None: 36 error = self.subprocess.stderr.read() 37 else: 38 error = '' 39 return "%s ; command: %s; error: %s" % (self.message, 40 self.command, 41 error)
42