UINS_CAT = 100
WIN_REG_SEARCH_FAIL = 101
UNIMPL_APP = 200
SYS_ERR = 300
TIME_OUT = 400
DIM_INCO_FILE_FMT = 500 DIM_FILE_VAL_INCO = 501
errorTable = {
UINS_CAT: 'Application is not able to find the installed catalyst',
WIN_REG_SEARCH_FAIL: 'Windows Registry search for catalysts version is unsuccessful',
UNIMPL_APP: 'Unimplemented Application requirement',
SYS_ERR: 'System error occurred - Please check the source code',
TIME_OUT: 'Operation is timed out',
DIM_INCO_FILE_FMT: 'incorrect file format for dimension - Not able to find dimension',
DIM_FILE_VAL_INCO: 'Value coming from dimension file is incorrect'
}
class TimeoutException(Exception):
pass
class ApplicationException(Exception):
def __init__(self, fileName, errno, msg = ""):
self.fileName = fileName
self.errno = errno
self.mess = errorTable[errno] + msg
self.message = 'Application ERROR:'+repr(self.fileName+'-'+str(self.errno)+'-'+self.mess)
def __str__(self):
return repr(self.fileName+'-'+str(self.errno)+'-'+self.mess)
if __name__ == '__main__':
try:
raise ApplicationException('errorHandler', SYS_ERR)
except:
print 'Generic exception'