2010-07-05 06:17:08 +02:00
|
|
|
#!/usr/bin/python2
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
#Copyright 2009-2010 Matt Turnbull
|
|
|
|
#This program is free software: you can redistribute it and/or modify
|
|
|
|
#it under the terms of the GNU Affero General Public License as published by
|
|
|
|
#the Free Software Foundation, version 3 of the License.
|
|
|
|
#
|
|
|
|
#This program 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 Affero General Public License
|
|
|
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
|
|
|
|
2009-08-12 02:46:39 +02:00
|
|
|
class FpdbError(Exception):
|
2009-08-28 19:24:51 +02:00
|
|
|
def __init__(self, value):
|
|
|
|
self.value = value
|
|
|
|
def __str__(self):
|
|
|
|
return repr(self.value)
|
2009-08-12 02:46:39 +02:00
|
|
|
|
2009-11-22 06:00:23 +01:00
|
|
|
class FpdbParseError(FpdbError):
|
2009-08-12 02:46:39 +02:00
|
|
|
def __init__(self,value='',hid=''):
|
|
|
|
self.value = value
|
2009-08-09 16:19:43 +02:00
|
|
|
self.hid = hid
|
2009-08-12 02:46:39 +02:00
|
|
|
def __str__(self):
|
2009-11-07 19:57:23 +01:00
|
|
|
if self.hid:
|
|
|
|
return repr("HID:"+self.hid+", "+self.value)
|
2009-08-12 02:46:39 +02:00
|
|
|
else:
|
|
|
|
return repr(self.value)
|
|
|
|
|
2009-09-04 13:49:46 +02:00
|
|
|
class FpdbDatabaseError(FpdbError):
|
|
|
|
pass
|
|
|
|
|
2009-11-22 06:00:23 +01:00
|
|
|
class FpdbMySQLError(FpdbDatabaseError):
|
2009-10-09 13:31:25 +02:00
|
|
|
pass
|
|
|
|
|
2009-11-22 06:00:23 +01:00
|
|
|
class FpdbMySQLAccessDenied(FpdbDatabaseError):
|
|
|
|
def __init__(self, value='', errmsg=''):
|
|
|
|
self.value = value
|
|
|
|
self.errmsg = errmsg
|
|
|
|
def __str__(self):
|
|
|
|
return repr(self.value +" " + self.errmsg)
|
|
|
|
|
2009-11-27 13:19:43 +01:00
|
|
|
class FpdbMySQLNoDatabase(FpdbDatabaseError):
|
|
|
|
def __init__(self, value='', errmsg=''):
|
|
|
|
self.value = value
|
|
|
|
self.errmsg = errmsg
|
|
|
|
def __str__(self):
|
|
|
|
return repr(self.value +" " + self.errmsg)
|
|
|
|
|
2009-12-12 10:51:07 +01:00
|
|
|
class FpdbPostgresqlAccessDenied(FpdbDatabaseError):
|
|
|
|
def __init__(self, value='', errmsg=''):
|
|
|
|
self.value = value
|
|
|
|
self.errmsg = errmsg
|
|
|
|
def __str__(self):
|
|
|
|
return repr(self.value +" " + self.errmsg)
|
|
|
|
|
|
|
|
class FpdbPostgresqlNoDatabase(FpdbDatabaseError):
|
|
|
|
def __init__(self, value='', errmsg=''):
|
|
|
|
self.value = value
|
|
|
|
self.errmsg = errmsg
|
|
|
|
def __str__(self):
|
|
|
|
return repr(self.value +" " + self.errmsg)
|
|
|
|
|
2010-01-28 11:55:06 +01:00
|
|
|
class FpdbHandError(FpdbError):
|
|
|
|
pass
|
|
|
|
|
|
|
|
class FpdbHandDuplicate(FpdbHandError):
|
|
|
|
pass
|
|
|
|
|
|
|
|
class FpdbHandPartial(FpdbHandError):
|
2009-08-28 19:24:51 +02:00
|
|
|
pass
|