/var/lib/gnumed/server/pycommon/gmExceptions.py is in gnumed-server 19.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | ############################################################################
#
# gmExceptions - classes for exceptions gnumed modules may throw
# --------------------------------------------------------------------------
#
# @author: Dr. Horst Herb
# @copyright: author
# @license: GPL v2 or later (details at http://www.gnu.org)
# @dependencies: nil
# @change log:
# 07.02.2002 hherb first draft, untested
############################################################################
class AccessDenied(Exception):
def __init__(self, msg, source=None, code=None, details=None):
self.errmsg = msg
self.source = source
self.code = code
self.details = details
#----------------------------------
def __str__(self):
txt = self.errmsg
if self.source is not None:
txt += u'\nSource: %s' % self.source
if self.code is not None:
txt += u'\nCode: %s' % self.code
if self.details is not None:
txt += u'\n%s' % self.details
return txt
#----------------------------------
def __repr__(self):
txt = self.errmsg
if self.source is not None:
txt += u'\nSource: %s' % source
if self.code is not None:
txt += u'\nCode: %s' % self.code
if self.details is not None:
txt += u'\n%s' % self.details
return txt
#------------------------------------------------------------
class DatabaseObjectInUseError(Exception):
def __init__(self, msg):
self.errmsg = msg
def __str__(self):
return self.errmsg
class ConnectionError(Exception):
#raised whenever the database backend connection fails
def __init__(self, errmsg):
self.errmsg=errmsg
def __str__(self):
return self.errmsg
class ConfigError(Exception):
#raised whenever a configuration error occurs
def __init__(self, errmsg):
self.errmsg=errmsg
def __str__(self):
return self.errmsg
class NoGuiError(Exception):
def __init__(self, errmsg):
self.errmsg=errmsg
def __str__(self):
return self.errmsg
class PureVirtualFunction(Exception):
#raised whenever the database backend connection fails
def __init__(self, errmsg=None):
if errmsg is not None:
self.errmsg=errmsg
else:
self.errmsg="Attempt to call a pure virtual function!"
def __str__(self):
return self.errmsg
#------------------------------------------------------------
# constructor errors
class ConstructorError(Exception):
"""Raised when a constructor fails."""
def __init__(self, errmsg = None):
if errmsg is None:
self.errmsg = "%s.__init__() failed" % self.__class__.__name__
else:
self.errmsg = errmsg
def __str__(self):
return self.errmsg
# business DB-object exceptions
class NoSuchBusinessObjectError(ConstructorError):
"""Raised when a business db-object can not be found."""
def __init__(self, errmsg = None):
if errmsg is None:
self.errmsg = "no such business DB-object found"
else:
self.errmsg = errmsg
def __str__(self):
return self.errmsg
#------------------------------------------------------------
class InvalidInputError(Exception):
"""Raised by business layers when an attempt is made to input
invalid data"""
def __init__(self, errmsg = None):
if errmsg is None:
self.errmsg = "%s.__init__() failed" % self.__class__.__name__
else:
self.errmsg = errmsg
def __str__(self):
return self.errmsg
#=====================================================================
|