Package install :: Package MoSTBioDat :: Package DataBase :: Package Connect :: Module MoSTBioDatErrors
[hide private]
[frames] | no frames]

Source Code for Module install.MoSTBioDat.DataBase.Connect.MoSTBioDatErrors

  1  #!/usr/bin/env python 
  2  ################################## 
  3  # MoSTBioDatErrors.py:           # 
  4  # Exceptions for MoSTBioDatDB.py # 
  5  ################################## 
  6   
  7  ###################################################### 
  8  # Copyright (c) 2007-2008 Andrzej Bak                # 
  9  # ARC Seibersdorf & University of Silesia            # 
 10  # Author: Andrzej Bak <Andrzej.Bak@us.edu.pl>        # 
 11  # License: GNU General Public License, version: 3    # 
 12  # URL: http://chemoinformatyka.us.edu.pl/mostbiodat/ # 
 13  # Version: 1, 06.01.2010                             # 
 14  ###################################################### 
 15   
 16  try: 
 17      import sys 
 18      import exceptions 
 19  except ImportError,e: 
 20      print 'Error: %s' %e 
 21      sys.exit(1) 
 22   
 23   
24 -class Error(exceptions.StandardError):
25 """ 26 Base class for other exceptions 27 """ 28 pass
29
30 -class Warning(exceptions.StandardError):
31 """ 32 Data truncations while inserting etc. 33 """ 34 pass
35
36 -class InterfaceError(Error):
37 """ 38 Database interface errors 39 """ 40 pass
41
42 -class DatabaseError(Error):
43 """ 44 Database errors 45 """ 46 pass
47
48 -class InternalError(DatabaseError):
49 """ 50 Internal database errors 51 """ 52 pass
53
54 -class OperationalError(DatabaseError):
55 """ 56 Database operation errors 57 """ 58 pass
59
60 -class ProgrammingError(DatabaseError):
61 """ 62 SQL syntax errors, wrong parameters etc. 63 """ 64 pass
65
66 -class IntegrityError(DatabaseError):
67 """ 68 Relational integrity of database errors 69 """ 70 pass
71
72 -class DuplicateEntryError(IntegrityError):
73 """ 74 Duplicate entry error 75 """ 76 pass
77
78 -class DataError(DatabaseError):
79 """ 80 Data processed errors 81 """ 82 pass
83
84 -class NotSupportedError(DatabaseError):
85 """ 86 Errors not supported by database 87 """ 88 pass
89
90 -class MissingInputError(DatabaseError):
91 """ 92 Missing user input 93 """ 94 pass
95
96 -class UserAuthenticationError(DatabaseError):
97 """ 98 User authentication failed 99 """ 100 pass
101 102
103 -class DataQueryError(DatabaseError):
104 """ 105 No data returned 106 """ 107 pass
108
109 -class ArrayError(DatabaseError):
110 """ 111 Empty array returned 112 """ 113 pass
114
115 -class DataImportTypeError(DatabaseError):
116 """ 117 Wrong data import type value 118 """ 119 pass
120
121 -class MissingDataError(DatabaseError):
122 """ 123 Missing import value 124 """ 125 pass
126
127 -class ErrorMessage(str):
128 - def __new__(cls, e):
129 obj = str.__new__(cls, e[1]) 130 obj.code = int(e[0]) 131 obj.module = e.__module__ 132 obj.exception = e.__class__.__name__ 133 return obj
134 ############### MAIN ############################# 135 if __name__=='__main__': 136 pass 137