Open Kilda Java Documentation
exc.py
Go to the documentation of this file.
1 # Copyright 2017 Telstra Open Source
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 #
15 
16 import pprint
17 
18 
19 class Error(Exception):
20  pass
21 
22 
24  @property
25  def details(self):
26  return self.args[0]
27 
28  def __init__(self, details):
29  super(NotImplementedError, self).__init__(details)
30 
31  def __str__(self):
32  return 'NOT IMPLEMENTED: {}'.format(self.details)
33 
34 
36  pass
37 
38 
39 class DBEmptyResponse(DBInvalidResponse):
40  def __str__(self):
41  return 'There is no record fetched from DB cursor'
42 
43 
45  def __str__(self):
46  return 'DB cursor contain too many result records'
47 
48 
50  @property
51  def query(self):
52  return self.args[0]
53 
54  @property
55  def params(self):
56  return self.args[1]
57 
58  def __init__(self, query, params):
59  super(DBRecordNotFound, self).__init__(query, params)
60 
61  def __str__(self):
62  return 'DB record not found'
63 
64 
66  @property
67  def details(self):
68  return self.args[1]
69 
70  @property
71  def data(self):
72  return self.args[0]
73 
74  def __init__(self, data, details):
75  super(UnacceptableDataError, self).__init__(data, details)
76 
77  def __str__(self):
78  return 'Unacceptable data - {}'.format(self.details)
79 
80 
82  @property
83  def data(self):
84  return self.args[0]
85 
86  @property
87  def nested_exception(self):
88  return self.args[1]
89 
90  def __init__(self, data, nested_exception):
91  super(MalformedInputError, self).__init__(data, nested_exception)
92 
93  def __str__(self):
94  return 'Malformed input record - {}:\n{}'.format(
95  self.nested_exception, pprint.pformat(self.data))
def __init__(self, data, nested_exception)
Definition: exc.py:90
def __init__(self, data, details)
Definition: exc.py:74
def __init__(self, details)
Definition: exc.py:28
def __init__(self, query, params)
Definition: exc.py:58