Coverage for Exceptions.py: 63%
51 statements
« prev ^ index » next coverage.py v7.6.3, created at 2024-10-15 19:33 +0000
« prev ^ index » next coverage.py v7.6.3, created at 2024-10-15 19:33 +0000
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
4# Copyright 2009-2011 Matt Turnbull
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU Affero General Public License as published by
7# the Free Software Foundation, version 3 of the License.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU Affero General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16# In the "official" distribution you can find the license in agpl-3.0.txt.
19class FpdbError(Exception):
20 def __init__(self, value):
21 self.value = value
23 def __str__(self):
24 return repr(self.value)
27class FpdbParseError(FpdbError):
28 def __init__(self, value="", hid=""):
29 self.value = value
30 self.hid = hid
32 def __str__(self):
33 if self.hid:
34 return repr("HID:" + self.hid + ", " + self.value)
35 else:
36 return repr(self.value)
39class FpdbDatabaseError(FpdbError):
40 pass
43class FpdbMySQLError(FpdbDatabaseError):
44 pass
47class FpdbMySQLAccessDenied(FpdbDatabaseError):
48 def __init__(self, value="", errmsg=""):
49 self.value = value
50 self.errmsg = errmsg
52 def __str__(self):
53 return repr(self.value + " " + self.errmsg)
56class FpdbMySQLNoDatabase(FpdbDatabaseError):
57 def __init__(self, value="", errmsg=""):
58 self.value = value
59 self.errmsg = errmsg
61 def __str__(self):
62 return repr(self.value + " " + self.errmsg)
65class FpdbPostgresqlAccessDenied(FpdbDatabaseError):
66 def __init__(self, value="", errmsg=""):
67 self.value = value
68 self.errmsg = errmsg
70 def __str__(self):
71 return repr(self.value + " " + self.errmsg)
74class FpdbPostgresqlNoDatabase(FpdbDatabaseError):
75 def __init__(self, value="", errmsg=""):
76 self.value = value
77 self.errmsg = errmsg
79 def __str__(self):
80 return repr(self.value + " " + self.errmsg)
83class FpdbHandError(FpdbError):
84 pass
87class FpdbHandDuplicate(FpdbHandError):
88 pass
91class FpdbHandPartial(FpdbParseError):
92 pass
95class FpdbHandSkipped(FpdbParseError):
96 pass
99class FpdbEndOfFile(FpdbHandError):
100 pass