00001 ################################################## 00002 # Custom exception classes for CdbVis ## 00003 # ## 00004 ################################################## 00005 00006 ## 00007 # Exception class for ConfDB query and db errors. 00008 # 00009 class DBError(Exception): 00010 00011 def __init__(self,*args): 00012 self.args = args 00013 self._type = "database" 00014 00015 def __str__(self): 00016 return "A " + str(self._type) + " error occured. The returned message from the ConfDB was: " + str(self.args[0]) 00017 00018 ## 00019 # Exception class for ConfDB connection errors. 00020 # 00021 class DBConnectionError(DBError): 00022 00023 def __init__(self,*args): 00024 DBError.__init__(self,*args) 00025 self._type = "connection" 00026 00027 00028 ## 00029 # Exception class for all Validation errors. 00030 # 00031 class ValidationError(Exception): 00032 00033 def __init__(self,*args): 00034 self.args = args 00035 self._type = "validation" 00036 00037 def __str__(self): 00038 return "A " + str(self._type) + " error occured: " + str(self.args[0]) 00039 00040 ## 00041 # Exception class for String Validation errors. 00042 # 00043 class StringError(ValidationError): 00044 00045 def __init__(self,*args): 00046 self.args = args 00047 self._type = "string validation" 00048 00049 ## 00050 # Exception class for Number (Integer and Float) validation errors. 00051 # 00052 class NumberError(ValidationError): 00053 00054 def __init__(self,*args): 00055 self.args = args 00056 self._type = "number validation" 00057 00058 ## 00059 # Exception clas for Subsystem name validation errors. 00060 # 00061 class SystemNameError(ValidationError): 00062 00063 def __init__(self,*args): 00064 self.args = args 00065 self._type = "system name validation" 00066 00067