Package jsondata ::
Module JSONDataExceptions
|
|
1
2 """Common exceptions for the package 'jsondata'.
3 """
4 __author__ = 'Arno-Can Uestuensoez'
5 __maintainer__ = 'Arno-Can Uestuensoez'
6 __license__ = "Artistic-License-2.0 + Forced-Fairplay-Constraints"
7 __copyright__ = "Copyright (C) 2015-2016 Arno-Can Uestuensoez @Ingenieurbuero Arno-Can Uestuensoez"
8 __version__ = '0.2.18'
9 __uuid__='63b597d6-4ada-4880-9f99-f5e0961351fb'
10
11 import sys
12 version = '{0}.{1}'.format(*sys.version_info[:2])
13 if not version in ('2.6','2.7',):
14 raise Exception("Requires Python-2.6.* or higher")
15
16
17
18
19 _interactive = False
20
22 """ base Exception."""
23
25 """To be replaced by derived Exceptions.
26
27 Fetch standard parameters and forward message to base class 'Exception'.
28 """
29 self.fetch(*arg)
30 Exception.__init__(self,self.s)
31
33 """Fetch arguments.
34
35 Args:
36 *args: The following order is expected:
37
38 0. Reason of exception.
39
40 1. Name of object that caused the exception.
41
42 2. Value of the object.
43
44 Returns:
45 None.
46
47 Raises:
48 None.
49 """
50 self.s=""
51 for a in arg:
52 self.s+=":"+str(a)
53 self.s=self.s[1:]
54
56 """Cause: <reason>:<object>:<value>"""
57 return self.s
58
60 """Cause with additional header text."""
61 return "ERROR::"+self.s
62
63
64
65
66
68 """ Error on key."""
69
73
75 return "JSONDataKeyError:"+self.s
76
78 """ Error on NodeTypes."""
80 return "JSONDataNodeType:"+self.s
81
83 """ Erroneous parameters."""
85 return "JSONDataParameter:"+self.s
86
88 """ Error on read of a source file."""
90 return "JSONDataSourceFile:"+self.s
91
93 """ Error on writing a file."""
95 return "JSONDataTargetFile:"+self.s
96
98 """ Error on a value."""
100 return "JSONDataValue:"+self.s
101