[3411] | 1 | # -*- coding: utf-8 -*-*- |
---|
[695] | 2 | # |
---|
[3249] | 3 | # PyKota : Print Quotas for CUPS |
---|
[695] | 4 | # |
---|
[3275] | 5 | # (c) 2003, 2004, 2005, 2006, 2007, 2008 Jerome Alet <alet@librelogiciel.com> |
---|
[3260] | 6 | # This program is free software: you can redistribute it and/or modify |
---|
[873] | 7 | # it under the terms of the GNU General Public License as published by |
---|
[3260] | 8 | # the Free Software Foundation, either version 3 of the License, or |
---|
[873] | 9 | # (at your option) any later version. |
---|
[3413] | 10 | # |
---|
[873] | 11 | # This program is distributed in the hope that it will be useful, |
---|
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 14 | # GNU General Public License for more details. |
---|
[3413] | 15 | # |
---|
[873] | 16 | # You should have received a copy of the GNU General Public License |
---|
[3260] | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
[695] | 18 | # |
---|
| 19 | # $Id$ |
---|
| 20 | # |
---|
[3249] | 21 | |
---|
[3288] | 22 | """This module defines ALL PyKota specific exceptions.""" |
---|
[3249] | 23 | |
---|
[3288] | 24 | class PyKotaError(Exception) : |
---|
| 25 | """Mother class of all PyKota exceptions.""" |
---|
| 26 | def __init__(self, value) : |
---|
| 27 | """Saves the value passed as a parameter.""" |
---|
| 28 | self.value = value |
---|
[3413] | 29 | |
---|
| 30 | def __str__(self) : |
---|
[3288] | 31 | """Returns an unicode string representation.""" |
---|
[3249] | 32 | try : |
---|
[3288] | 33 | return unicode(self.value, errors="replace") |
---|
[3413] | 34 | except TypeError : |
---|
[3288] | 35 | return unicode(self.value) # None and strings which are already unicode |
---|
[3413] | 36 | |
---|
[3288] | 37 | class PyKotaToolError(PyKotaError) : |
---|
| 38 | """PyKota Exception for all executables.""" |
---|
| 39 | pass |
---|
[3413] | 40 | |
---|
[3288] | 41 | class PyKotaToolError(PyKotaError) : |
---|
| 42 | """PyKota Exception for all executables.""" |
---|
| 43 | pass |
---|
[3413] | 44 | |
---|
[3288] | 45 | class PyKotaCommandLineError(PyKotaToolError) : |
---|
| 46 | """PyKota Exception for errors on executables' command line.""" |
---|
| 47 | pass |
---|
[3413] | 48 | |
---|
[3288] | 49 | class PyKotaStorageError(PyKotaError) : |
---|
| 50 | """PyKota Exception for database backend related errors.""" |
---|
| 51 | pass |
---|
[3413] | 52 | |
---|
[3288] | 53 | class PyKotaConfigError(PyKotaError) : |
---|
| 54 | """PyKota Exception for errors in PyKota's configuration.""" |
---|
| 55 | pass |
---|
[3413] | 56 | |
---|
[3288] | 57 | class PyKotaAccounterError(PyKotaError) : |
---|
| 58 | """PyKota Exception for errors in PyKota accounters.""" |
---|
| 59 | pass |
---|
[3413] | 60 | |
---|
[3288] | 61 | class PyKotaReporterError(PyKotaError) : |
---|
| 62 | """PyKota Exception for errors in PyKota report generators.""" |
---|
| 63 | pass |
---|
[3413] | 64 | |
---|
[3288] | 65 | class PyKotaLoggingError(PyKotaError) : |
---|
| 66 | """PyKota Exception for errors in PyKota logging.""" |
---|
| 67 | pass |
---|