1
2
3
4 """This module defines all pysql exceptions
5 @author: Sébastien Renard (sebastien.renard@digitalfox.org)
6 @license: GNU GPL V3
7 """
8
9
10 from time import ctime, time
11 from re import match
12
14 """Pysql Exceptions"""
16
17 self.oraCode=""
18 self.msg=""
19 self.time=None
20
21
22 self.time=time()
23
24
25 self.msg=unicode(exception)
26
27
28 if isinstance(exception, PysqlException):
29 self.msg=exception.msg
30 self.oraCode=exception.oraCode
31 self.time=exception.time
32 else:
33 result=match("(.*)(ORA-\d+): (.*)", unicode(exception))
34 if result:
35 self.oraCode=result.group(2)
36 self.msg=result.group(1)+result.group(3)
37
38
39 Exception.__init__(self, exception)
40
42 """@return: exception creation timestamp as a formated string"""
43 return ctime(self.time)
44
46 if self.oraCode=="":
47 return self.msg
48 else:
49 return self.oraCode +"-" + self.msg
50
52 """Indicates function not yet implemented"""
55
57 """Indicates user is not granted to perform this action"""
60
62 """
63 A dummy exception which makes it possible to have --help exit silently
64 """
65 pass
66